I am submitting a form using ajax. What I have done so far is that I have got all checked checkbox (with same name). I am using $.each() function to iterate through them But I need it to be synchronized.
jQuery.each(jQuery("input[name='checkboxes_name']:checked"), function(){
if (jQuery(this).val()=='some_val') { // processing goes here}
if (jQuery(this).val()=='some_val2') { // processing goes here}
}
Whats happening now is that it enter IF statement when condition is met, starts processing it and moves on to next iteration of EACH function (previous one is still in progress). That way it starts executing multiple IF statement simutaneously. What I need to do is Next iteration does not start until processing is done for previous iteration.
I hope you guys understand.