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?