aeroswat Posted January 12, 2010 Share Posted January 12, 2010 Ok it is alerting error2. After it alerts error2 it alerts bla22... self recursion? wtf? function update(fInp, valu) { alert('bla1'); var ord = document.getElementById('ctrordernumber').value; alert('bla2'); alert (fInp.length); alert (valu.length); if(fInp.length != 0 && valu.length != 0){ $.post("updateorder-exec.php", {field: ""+fInp+"", val: ""+valu+"", on: ""+ord+""}, function(data){ alert('bla22'); if(data.length >0) { alert('bla3'); if(data) { //$('#errDiv').show(); //$('#errDiv').html("Database updated!"); alert('updated'); //$('#errDiv').css('opacity',100).fadeOut(10000); } else{ alert('error'); //$('#errDiv').show(); //$('#errDiv').html("Error. Incorrect information entered!"); //$('#errDiv').css('opacity',100).fadeOut(10000); } return data; } }); } alert('error2'); //$('#errDiv').show(); //$('#errDiv').html("Error. Incorrect information entered!"); //$('#errDiv').css('opacity',100).fadeOut(10000); return 0; } Quote Link to comment Share on other sites More sharing options...
aeroswat Posted January 12, 2010 Author Share Posted January 12, 2010 u8pdated Quote Link to comment Share on other sites More sharing options...
Sesquipedalian Posted January 13, 2010 Share Posted January 13, 2010 You call alert('bla22') in the callback function, so that doesn't get triggered until your file is loaded with $.post. It just keeps going on with the code and then executes the callback function when the file is actually loaded. Why does it matter, though? Quote Link to comment Share on other sites More sharing options...
aeroswat Posted January 13, 2010 Author Share Posted January 13, 2010 You call alert('bla22') in the callback function, so that doesn't get triggered until your file is loaded with $.post. It just keeps going on with the code and then executes the callback function when the file is actually loaded. Why does it matter, though? I found out I need a synchronous call Everything has to be done in order because this function is not returning the information that it needs to return before another function executes what it needs to do. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.