Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

307
Views
(Error interno del servidor) solicitud ajax y laravel 2022

Tengo un problema para agregar al carrito en laravel 8 con una solicitud ajax. Cuando hago clic en el botón Agregar al carrito, se supone que aparece una alerta, pero en su lugar aparece el 500 (Error interno del servidor) en la consola.

En primer lugar, te mostraré mi código js:

 $('.addToCartBtn').click(function (e) { e.preventDefault(); var product_id = $(this).closest('.product_data').find('.prod_id').val(); var product_qty = $(this).closest('.product_data').find('.qty-input').val(); var flavour_id = $(this).closest('.product_data').find('.flav_select').val(); var size_id = $(this).closest('.product_data').find('.size_select').val(); $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }); $.ajax({ type:"POST", //_method: "PUT", url:"/add-to-cart", data: { 'product_id':product_id, 'product_qty':product_qty, 'flavour_id':flavour_id, 'size_id':size_id, }, success: function (response) { alert(response.status ) ; } }); });
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!