hi guys...
i really need help on this one...
i try to put a form like this
<script>
function checkuser()
{
var xmlhttp;
if(window.XMLHttpRequest)
{
xmlhttp=new window.XMLHttpRequest(); //for mozilla
}
else
{
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState == 4 && xmlhttp.status ==200)
{
var response=xmlhttp.responseText;
if (response="1"){
return (true);
}
else{
return (false);
}
}
}
var nocache = Math.random();
xmlhttp.open("GET","file.php?nocache="+nocache,false);
xmlhttp.setRequestHeader("content-type","application/x-www-form-urlencoded");
xmlhttp.send(null);
}
</script>
<form method="post" action="somewhere.php" onSubmit="checkuser()">
<input type="submit" value="submit">
</form>
when i press submit button, i want to run a checking first whether it return true or false. if false, it won't go to "somewhere.php". but then the page keep going to somewhere.php even if it return false..