i just set async to false and that fixed the problem.. i also fixed a couple other bugs that i noticed in my code along the way.. so if there is a better way than async:false let me know thanks!
On Jul 1, 10:22 am, DXCJames <[EMAIL PROTECTED]> wrote: > In the code below It seems that if i uncomment the return true; at the > bottom it seems to happen before the ajax call is complete.. is there > anyway to force it to wait for the call or have the call back return > true or false and have that be returned to the submit's function? > > $("form").bind("submit",function() { > $.ajax({url: "", > cache: false, > type: "POST", > dataType: "json", > data: $("form").serializeArray(), > success: function(data) { > if(data.ErrorsFound != "") { > > $("div#ErrorsFound").text(data.ErrorsFound); > $("form#register > input").each(function(i, element){ $ > (element).removeClass(data.removeClasses); }); > $.each(data.requiredfields, > function(i, required) { > > if($("input#"+required.field).hasClass(required.classname) != > true) { > $ > ("input#"+required.field).addClass(required.classname).focus(); > } > }); > return false; > } else { > return true; > } > } > }); > if($("div#ErrorsFound").text() == ""){ > //return true; > }else{ > return false; > } > });