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? Link to comment https://forums.phpfreaks.com/topic/202455-ajax-jquery-problem/ 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. Link to comment https://forums.phpfreaks.com/topic/202455-ajax-jquery-problem/#findComment-1061434 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.