Hi All, Here is a simple fragment:
function zipSearch(){ var zip = $j('input#zip_entry').attr('value'); validateZip(zip); alert('second '+validation); ........... ............ } function validateZip(zip){ $j.post("markers.php", { validate: zip}, function(xml){ validation = $j.xml2json(xml, false); alert('first '+validation); }); } The problem is that the first function (zipSearch) calls validateZip and doesn't wait until it gets callback data from php file. So it jumps to the next line. I am getting 1st alert ('second '+validation) and next the alert from ajax function. How can I fix it to make sure the first function waits until validateZip gets its callback? thanks!