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.
Here, code is sloppy, but it WORKS. http://laravel.io/forum/04-29-2015-people-asking-about-jquery-ajax
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
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community