Support the ongoing development of →
Input Database Eloquent
Last updated 2 years ago.

It's just standard ajax request from web browser.

You can use $.post(..) method of jQuery, to send POST request through ajax, and like u wrote you have to listen on "click" event on every checkbox u have on list.

I would go with something like Input boxes:

<input type='checkbox' data-taskid='4543' class='taskchecker'>
<input type='checkbox' data-taskid='1452' class='taskchecker'>
<input type='checkbox' data-taskid='8532' class='taskchecker'>

Then in javascript:

$(".taskchecker").on("change", function() {
   var taskId = $(this).attr("data-taskid"); // gets task ID of clicked checkbox
   var state = $(this).is(':checked'); // gets if checkbox is checked or not
  $.post("/changestatustask", {'idTask':taskId, 'checkboxStatus':state}, function() {
    // you can add some code here in response to ajax request

This code is pretty simple and sloppy, and prolly have some mistakes, but should illustrate how can you to do it.



i think your method fit with my request but i have a problem:

i catch constantly a 405 error (method not allowed)....and i don't know why


Make sure checkbox (a value) isset, if not then 0 (zero).


Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.