473,322 Members | 1,241 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Alert box Undefined

My alert box gives "undefined' when i return some 'true or false'.Please solve my problem
Nov 11 '08 #1
6 1708
DrBunchman
979 Expert 512MB
Hi gowthamkg,

Can you show us the code you are using please.

Thanks,

Dr B
Nov 11 '08 #2
Expand|Select|Wrap|Line Numbers
  1. alert(frmregistration('EmailId'));
  2.     if(frmregistration('EmailId')==false)
  3.     {
  4.  
  5.         return false;
  6.     }
  7.  
  8.  
  9. function frmregistration(sValidateUserAndEmailId)
  10. {
  11.  
  12.     var xmlHttp;
  13.     try
  14.   {
  15.   // Firefox, Opera 8.0+, Safari
  16.   xmlHttp=new XMLHttpRequest();
  17.   }
  18. catch (e)
  19.   {
  20.   // Internet Explorer
  21.   try
  22.     {
  23.     xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  24.     }
  25.   catch (e)
  26.     {
  27.     try
  28.       {
  29.       xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  30.       }
  31.     catch (e)
  32.       {
  33.       alert("Your browser does not support AJAX!");
  34.       return false;
  35.          }
  36.         }
  37.     }
  38.  
  39.     //get user entered city name
  40.     var txtname=document.getElementById('txtuname').value;
  41.     var strEmail=document.getElementById('txtemail').value;
  42.     if(sValidateUserAndEmailId=='ValidateUserName')
  43.     {
  44.         xmlHttp.open("GET","CommonHTTP.asp?name="+ txtname,true);
  45.     }
  46.     else if(sValidateUserAndEmailId=='EmailId')
  47.     {
  48.  
  49.         xmlHttp.open("GET","CommonEmailHTTP.asp?EmailId="+ strEmail,true);
  50.     }
  51.  
  52.     xmlHttp.send();
  53.     xmlHttp.onreadystatechange=function()
  54.     {
  55.      //if request has been entertained and response is returned from server
  56.      if(xmlHttp.readyState==4)
  57.      {
  58.       //document.getElementById('dvweather').innerHTML=xmlHttp.responseText;
  59.       //alert(xmlHttp.responseText);
  60.       if(xmlHttp.responseText=="Failed")
  61.       {
  62.         if(sValidateUserAndEmailId =='ValidateUserName')
  63.             {
  64.                 alert("This user already exist");
  65.  
  66.             }
  67.         else if(sValidateUserAndEmailId =='EmailId')
  68.             {
  69.                 alert("This Email already exist");
  70.             }
  71.         return false;
  72.       }
  73.       else
  74.       {
  75.         if(sValidateUserAndEmailId =='ValidateUserName')
  76.         {
  77.             alert("This user Does not exist");
  78.         }
  79.         return true;
  80.         //document.registration.action="CommonHTTP.asp";
  81.       }
  82.      }
  83.     }
  84.  
  85. }
Nov 11 '08 #3
DrBunchman
979 Expert 512MB
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 B
Nov 11 '08 #4
alert(frmregistration('EmailId'));.actually this function comes bottom, i have just added in the starting.
Nov 12 '08 #5
JamieHowarth0
533 Expert 512MB
Hi guys,

This thread has been moved to the Javascript forum as it is not a classic ASP-related question.

Many thanks,

codegecko
Moderator
Nov 12 '08 #6
acoder
16,027 Expert Mod 8TB
The frmregistration function makes an Ajax request which is asynchronous and the callback function does the alerting anyway. So there's no need for an alert. Just call frmregistration instead.
Nov 12 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Justin Koivisto | last post by:
Is there a way to create an alert-like message box that uses a custom image? Basically, I want to replace the default ! image with something else. -- Justin Koivisto - spam@koivi.com PHP...
15
by: optimistx | last post by:
How to write a function f(x) or f('x') so that it produces the same output as a call to alert-function: var x='abc'; alert('x='+x); In testing one needs to write similar alert() calls...
6
by: Jorntk | last post by:
<script language="JavaScript"> !-- function onLoad() { if( self.innerWidth < 1024 ) { self.moveTo( 0, 0 ); self.resizeTo( screen.availWidth, screen.availHeight ); }
5
by: sniper | last post by:
hi ; i have this small code that consist in taking the name of the user and writing it in the same form as an output.the name is relative to /data/valid/string1 In my Js code i want to access the...
4
by: yawnmoth | last post by:
I'm trying to display a popup showing which radio button is selected and am unable to do so. Every time I try, I get undefined, instead of the value of the particular form variable I'm trying to...
4
by: joe | last post by:
Hi, I defined: <div id="abc"> </div> in my .html file, after an Ajax query my weberserver sends: <script language="JavaScript"> alert('Hello World!"); </script>
4
by: Phil | last post by:
Hi, The Alert window appears but the value is "undefined". I tried two ways What don't i see here? Thanks Phil <html xmlns="http://www.w3.org/1999/xhtml" > <head...
10
by: MichiganMan | last post by:
This is a program to just calculate a weekly gross salary based on the hourly wage and hours worked (with overtime too). I am not getting the alert box when it calculates it. Can anyone see what I...
4
by: Buzby | last post by:
I want a drop down date selection box on a form in the format of Mon 18 June 2007, that will go say 400 days in advance from the current date. Can anyone point me in the right direction as I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.