Hi I have never really bothered with javascript before but i am having alot of problems with a ajax php form my php code returns
if ($states==false)
{
$result = 'nostates';
$result = trim($result);
return $result;
exit;
}
And my javascript alert returns nostates but always executes the else statement when php returns nostates
document.getElementById("tempresult").innerHTML=xmlHttp.responseText;
var stateval;
var stateval = document.getElementById("tempresult").value;
alert('State Value' +stateval);
if (stateval == "nostates")
{
document.getElementById('staterow').style.visibility='hidden';
document.getElementById('cityrow').style.visibility='hidden';
document.getElementById('postalrow').style.visibility='hidden';
getcitybycc();
}
else
{
document.getElementById('staterow').style.visibility='visible';
document.getElementById('stateinput').innerHTML=xmlHttp.responseText;
document.getElementById('cityrow').style.visibility='hidden';
document.getElementById('postalrow').style.visibility='hidden';
}
Any advice? this is driving me nuts :confused: