I'm running Ajax validation on a form I have, and the following is my javascript file. It runs fine, except for the statechangedFname portion. You can see its different from the other statechanged, as I added a nested if statement if (xmlhttp.status == 200) { Code (markup): This is standard in Ajax, to see if the response is "ok." For some reason, the javascript stops reading once it gets to a nested if statement inside my functions! It doesn't matter if I have var test=1 if (test==1) { Code (markup): which is obviously true, it stops reading. If I have any code below (not in) the if statement, those are not read either. I don't understand why, as it should work correct? Thanks! // JavaScript Document var xmlhttp; function checkAjaxAlpha(str , id) { str = encodeURIComponent(str); if (str.length==0) { //Check ID, output to correct Document ID if (id=="Fname") { document.getElementById("alpha_check_fname").innerHTML=""; } if (id=="Lname") { document.getElementById("alpha_check_lname").innerHTML=""; } if (id=="City") { document.getElementById("alpha_check_city").innerHTML=""; } return; } xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your browser does not support XMLHTTP!"); return; } var url="../users/form_checks/alpha.php"; url=url+"?q="+str; url=url+"&sid="+Math.random(); if (id=="Fname") { xmlhttp.onreadystatechange=stateChangedFname; } if (id=="Lname") { xmlhttp.onreadystatechange=stateChangedLname; } if (id=="City") { xmlhttp.onreadystatechange=stateChangedCity; } xmlhttp.open("GET",url,true); xmlhttp.send(null); } function stateChangedFname() { if (xmlhttp.readyState==4) { if (xmlhttp.status == 200) { document.getElementById("alpha_check_fname").innerHTML=xmlhttp.responseText; } } } function stateChangedLname() { if (xmlhttp.readyState==4) { if(xmlHttpRequest.status==200){ document.getElementById("alpha_check_lname").innerHTML=xmlhttp.responseText; } } } function stateChangedCity() { if (xmlhttp.readyState==4) { document.getElementById("alpha_check_city").innerHTML=xmlhttp.responseText; } } function GetXmlHttpObject() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject) { // code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } Code (markup):