I have a long list of checkboxes like so:
<input class='masterCheckbox' type='checkbox' onclick='clickAll()' />
<input class='modifyDb' type='checkbox' onclick='ajaxCall(someId)' />
<input class='modifyDb' type='checkbox' onclick='ajaxCall(someId)' checked />
<input class='modifyDb' type='checkbox' onclick='ajaxCall(someId)' checked />
... lets say there's exactly 100 ...
<input class='modifyDb' type='checkbox' onclick='ajaxCall(someId)' />
<input class='modifyDb' type='checkbox' onclick='ajaxCall(someId)' />
<input class='modifyDb' type='checkbox' onclick='ajaxCall(someId)' checked />
The ajaxCall() function makes an ajax call (using jQuery) to a PHP page to make some change in the DB.
I want the masterCheckbox checkbox, when checked, to go through all the unchecked checkboxes and click them all, so that they each make a separate ajax call.
Using jQuery, I managed to get all the modifyDb checkboxes and then with the .each() function called a .click() on each element. This works visually; the checkboxes are toggled, but the ajax call is not made.
Is this because the ajax calls are made too fast? Can I queue up the function calls somehow?