I have this simple function
function Login()
{
var x=prompt("Please enter your name","");
var xmlhttp;
if (window.XMLHttpRequest)
{// Използваните браузъри
xmlhttp=new XMLHttpRequest();
}
else
{// Кой ли ползва тези версии..
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","login.php?u="+x,true);
xmlhttp.send();
}
The problem is when the user decide to exit the prompt box by clicking ESC.Can someone explain to me what exactly happen with the variable x in this case.I get to the conclusion that it get assignied with the value ‘null’ and by null I mean a string, because when I check with
If(!is_null($u))
my script doesn’t work, but if I replace this with
If($u!='null')
then everything works just fine, so could someone explain me what in fact is happening with the prompt box value when you exit it with pressin ESC?
It returns as if you had clicked cancel.
It is
nullnot as a string ..will alert
trueif you press Esc or cancel button