My alert box gives "undefined' when i return some 'true or false'.Please solve my problem
Alert box Undefined
Collapse
X
-
-
Code:alert(frmregistration('EmailId')); if(frmregistration('EmailId')==false) { return false; } function frmregistration(sValidateUserAndEmailId) { var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } //get user entered city name var txtname=document.getElementById('txtuname').value; var strEmail=document.getElementById('txtemail').value; if(sValidateUserAndEmailId=='ValidateUserName') { xmlHttp.open("GET","CommonHTTP.asp?name="+ txtname,true); } else if(sValidateUserAndEmailId=='EmailId') { xmlHttp.open("GET","CommonEmailHTTP.asp?EmailId="+ strEmail,true); } xmlHttp.send(); xmlHttp.onreadystatechange=function() { //if request has been entertained and response is returned from server if(xmlHttp.readyState==4) { //document.getElementById('dvweather').innerHTML=xmlHttp.responseText; //alert(xmlHttp.responseText); if(xmlHttp.responseText=="Failed") { if(sValidateUserAndEmailId =='ValidateUserName') { alert("This user already exist"); } else if(sValidateUserAndEmailId =='EmailId') { alert("This Email already exist"); } return false; } else { if(sValidateUserAndEmailId =='ValidateUserName') { alert("This user Does not exist"); } return true; //document.registration.action="CommonHTTP.asp"; } } } }Last edited by DrBunchman; Nov 11 '08, 02:49 PM. Reason: Added [Code] Tags - Please use the '#' buttonComment
-
gowthamkg,
Please don't forget to wrap your code in CODE tags - it makes your posts much easier to read - and please read the Posting Guidelines if you have not done so already.
Which alert box is causing you the problem?
Dr BComment
-
Hi guys,
This thread has been moved to the Javascript forum as it is not a classic ASP-related question.
Many thanks,
codegecko
ModeratorComment
Comment