...

View Full Version : ajax debugging



esthera
10-28-2010, 12:55 PM
i'm trying to use ajax to check if a username already exists when registering

I have


function zvalidateusername(username) {
var validusername = true;
// alert(mobilenumber);
http.abort();
http.open("GET", "checkusername.asp?username=" + username, true);
//alert("here");
http.onreadystatechange = function() {
if (http.readyState == 4) {
myresult = http.responseText;
// alert(myresult);
if (myresult != "True") {
// alert(myresult);
// validusername = false;
alert("שם משתמש נמצא כבר בשימוש במערכת");
return false;
//false
}
else {
return true;
}
}
}
http.send(null);
// alert(document.forms['register'].ccvalid.value);



}

and then within my validation


if (!zvalidateusername(document.getElementById("x_Username").value)) return false;

but this makes you not able to ever submit the form?
why would this be>


the following works in validation

if (!checkValidString(document.getElementById("x_Username").value)) return false;
if (!checkValidString(document.getElementById("x_Password").value)) return false;

esthera
10-28-2010, 01:54 PM
I solved the issue

i had to put the return true or return false at the end



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum