havenpets Posted May 20, 2010 Share Posted May 20, 2010 function check_form(){ httpObject.onreadystatechange = function() { if(httpObject.readyState == 4){ run_ajax(httpObject.responseText); } } } function run_ajax(solution){ if(solution == 0){ $("#"+formtype).addClass('ui-state-error'); updateTips("This "+formtype+" already exists in our database."); return false; }else{ return true; } } (later in coding) function (){ var bValid = true; bValid = bValid && check_form("username"); if(bValid){ alert("SUCCESS"); } (I took out all the unnecessary coding. The problem lies with it not saying success even though it is! When I alert bValid before the if(), it says "undefined". Anyone know a way around this? Quote Link to comment Share on other sites More sharing options...
trq Posted May 21, 2010 Share Posted May 21, 2010 Why aren't you using jQuery's Ajax implementation? It will make your life much easier and your code code much more stable / easier to maintain. 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.