Hi,
I have the following code bound to the click event of a button:
function submitForm() {
var $submitOK = false;
$('#form1').ajaxSubmit({
beforeSubmit: function() {
$submitOK = $('#form1').valid();
return $submitOK;
},
success: function(html, status) {
$("#response").text(html.substring(1, html.length - 1));
}
});
if ($submitOK) {
processForm1();
}
return $submitOK;
}
How does the timing of the ajaxSubmit and the beforeSubmit callback play out - will the beforeSubmit callback always return before execution returns from the ajaxSubmit()?
The code behaves as desired - returning $submitOK equal to the result of $('#form1').valid(), but I wanted to make sure this is deterministic behaviour.
Thanks.