Forum Moderators: open
function loadurl(dest) {
try
{
xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
}
xmlhttp.onreadystatechange = triggered;
xmlhttp.open("GET", dest);
xmlhttp.send(null);
}
function triggered()
{
if ((xmlhttp.readyState === 4) && (xmlhttp.status === 200))
{
switch(eval(xmlhttp.responseText))
{
case 0:
{
err+=2;
break;
}
case 1:
{
err++;
break;
}
case 2:
{
err++;
break;
}
}
pass = true;
}
}
function validate()
{
err = 0;
if(!emailValidate) err++;
if(!emailConfirmValidate) err++;
if(!usernameValidate) err++;
if(!firstNameValidate) err++;
if(!lastNameValidate) err++;
if(!termsValidate) err++;
loadurl('?un='+username.value+'&em='+email.value);
if(err) return false;
}
anything will help! thanks
Took me a while to figure it out. So I gave up on trying to stop the javascript from running. I read that doing xmlhttprequest synchronously was risky, but i figured that the file was small enough that it would work. So I changed it to load that way but it would never display the result. I finally figured it out... it was still waiting for a callback on the readyState, but the callback wasn't being called (duh). so i put the code from the call back after xmlhttprequest.send(null). It finally works.