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

194
Views
¿Cómo pasar doble variable a través de laravel jquery? No se muestra ninguna respuesta al hacer clic en el botón

Estoy tratando de enviar una solicitud jquery para actualizar la tabla, esa ruta requiere dos variables id, Receive_id. Probé este código a continuación, pero el botón al hacer clic no muestra ninguna respuesta. Por favor, revise mi código o sugiérame si hay otras formas de enviar la ruta. aquí está mi código de hoja

 <button data-url="{{ route('repairs.updateCylinder',['id'=> $cylinder->id, 'receive_id' => $data->id]) }}" class="btn btn-primary submit" id='update-cylinder'>Update</button>

Aquí está el código Jquery,

 <script> $(document).ready(function(){ $(document).on("click", "#update-cylinder", function() { // e.preventDefault(); var url = current.data('url') var id= $.ajax({ url: url, type: "PATCH", cache: false, data:{ _token:'{{ csrf_token() }}', body_leak: $('#body-leak').val(), nozzle_change: $('#nozzle-change').val(), nozzle_repair: $('#nozzle-repair').val(), cap_change: $('#cap-change').val(), washer_change:$('#washer-change').val(), wash:$('#wash').val(), refill:$('#refill').val(), remarks:$('#remarks').val() }, success: function(dataResult){ dataResult = JSON.parse(dataResult); if(dataResult.statusCode) { window.location = "/repairs/updateCylinder"; } else{ alert("Internal Server Error"); } } }); }); }); </script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede agregar una identificación de datos en su botón:

 <button data-id="{{$cilinder->id}}" data-receive-id="{{ $data->id }}" class="btn btn-primary submit" id='update-cylinder'>Update</button>

y en su sección de script:

 $("#update-cylinder").on("click", function(e) { e.preventDefault(); let id = $(this).data("id"); let receive_id = $(this).data("receive-id"); let url = "repairs/updateCylinder/"+ id; let data = new FormData($('#id_form')[0]); $.ajax({ url: url, type: "PATCH", cache: false, data : data, datatype:'json', success: function(response){ if(response.success == true){ window.location "/repairs/cylinderlist"; }else{ alert("Error to update..."); } }); }
about 4 years ago · Juan Pablo Isaza Report
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!