+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13

Thread: ajax return undefined

  1. #1
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    390
    Rep Power
    3

    ajax return undefined

    hi
    i m using ajax like this
    Code:
    var sTarget = 'EmergencyDocCreation_CheckForInvoiceDuplicate.asp';
    						sTarget += '?SupplierID=<%=lSupplierID%>';
    						sTarget += '&DocumentRef=' + escape($('txtDocumentRef').value);
    						sTarget += '&DocumentDate=' + escape($('txtDocumentDate').value);
    						sTarget += '&ValueExclVAT=' + escape($('txtDocumentExclVAT').value);						
    
    						//Check for duplicate invoice
    						 var ajaxRequest  = new Ajax.Request(sTarget,
    										 { 
    											evalScripts: true, 
    											asynchronous: false
    	 									 }
       										);
    				alert(ajaxRequest.responseText); 
    Code:
    	'Get parameters from the querystring
    	lSupplierID = CLng(Request.QueryString("SupplierID"))
    	sDocumentRef = Request.QueryString("DocumentRef")
    	sDocumentDate = Request.QueryString("DocumentDate")
    	sValueExclVAT = Request.QueryString("ValueExclVAT")
      
      'Response.ContentType = "text/javascript"
      Response.write "<script type=""text/javascript"">alert('hello');</script>"
      Response.End
    
    i m getting undefined value it should return hello alert.
    what i m missing??
    thanks
    Love is physical attraction and mental destruction

  2. #2
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Washington, D.C.
    Posts
    2,347
    Blog Entries
    9
    Rep Power
    19

    What exactly are you trying to do with this? Why use AJAX to display a JavaScript alert?
    jmurrayhead
    If you agree, give me rep. If my post helped you, click "Thanks".
    If you like it here...throw us a few bones to help support us.


  3. #3
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    390
    Rep Power
    3

    actaully i m checking my ajax code is working or not .
    Love is physical attraction and mental destruction

  4. #4
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Washington, D.C.
    Posts
    2,347
    Blog Entries
    9
    Rep Power
    19

    Quote Originally Posted by guddu View Post
    actaully i m checking my ajax code is working or not .
    Okay, give me some details. What is this AJAX supposed to do?
    jmurrayhead
    If you agree, give me rep. If my post helped you, click "Thanks".
    If you like it here...throw us a few bones to help support us.


  5. #5
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    390
    Rep Power
    3

    see i m calling asp file with query string .i m calling this way
    Code:
    var sTarget = 'EmergencyDocCreation_CheckForInvoiceDuplicate.asp';
    						sTarget += '?SupplierID=<%=lSupplierID%>';
    						sTarget += '&DocumentRef=' + escape($('txtDocumentRef').value);
    						sTarget += '&DocumentDate=' + escape($('txtDocumentDate').value);
    						sTarget += '&ValueExclVAT=' + escape($('txtDocumentExclVAT').value);						
    
    						//Check for duplicate invoice
    						 var ajaxRequest  = new Ajax.Request(sTarget,
    										 { 
    											evalScripts: true, 
    											asynchronous: false
    	 									 }
       										);
    
    now before everything i want to check that my querystring value is reaching at asp page or not .if i m getting querystring at my asp page then i assume my ajax code is working.
    hope it make some sense.
    Love is physical attraction and mental destruction

  6. #6
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Washington, D.C.
    Posts
    2,347
    Blog Entries
    9
    Rep Power
    19

    Take a look at the AJAX tutorial here: Ajax Tutorial - XMLHttpRequest

    Unless I'm missing something or not understanding something, I don't see where you are Opening the request to the specified page.
    jmurrayhead
    If you agree, give me rep. If my post helped you, click "Thanks".
    If you like it here...throw us a few bones to help support us.


  7. #7
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    390
    Rep Power
    3

    here i m opening request.i dont want to use xmlhttp request.
    var ajaxRequest = new Ajax.Request(sTarget,
    {
    evalScripts: true,
    asynchronous: false
    }
    Love is physical attraction and mental destruction

  8. #8
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Washington, D.C.
    Posts
    2,347
    Blog Entries
    9
    Rep Power
    19

    Okay, just to warn you, my custom AJAX is far from great...but what happens with something like this:

    Code:
    var url = ''EmergencyDocCreation_CheckForInvoiceDuplicate.asp' 
    url += '?SupplierID=<%=lSupplierID%>';
    url += '&DocumentRef=' + escape($('txtDocumentRef').value);
    url += '&DocumentDate=' + escape($('txtDocumentDate').value);
    url += '&ValueExclVAT=' + escape($('txtDocumentExclVAT').value); 
    url = encodeURIComponent(url);  
    new Ajax.Request(url, { 
      method: 'get', 
      evalJS: true,
      asynchronous: false,
      onSuccess: function(transport) { 
        // Alert on success
        alert('Hello World');
      } 
    });
    
    jmurrayhead
    If you agree, give me rep. If my post helped you, click "Thanks".
    If you like it here...throw us a few bones to help support us.


  9. #9
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    390
    Rep Power
    3

    object expected error.when i put your code as it is.did u run at your end.
    Love is physical attraction and mental destruction

  10. #10
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Washington, D.C.
    Posts
    2,347
    Blog Entries
    9
    Rep Power
    19

    Quote Originally Posted by guddu View Post
    object expected error.when i put your code as it is.did u run at your end.
    I'm unable to test on my end...does it state what line the error occurs on?
    jmurrayhead
    If you agree, give me rep. If my post helped you, click "Thanks".
    If you like it here...throw us a few bones to help support us.


+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. triple combo ajax
    By dragon rider in forum ASP Development
    Replies: 0
    Last Post: October 16th, 2008, 04:34 PM
  2. .Net And Ajax
    By smithcarvo in forum .Net Development
    Replies: 2
    Last Post: August 20th, 2008, 07:50 AM
  3. Return Default Date If Null
    By jmurrayhead in forum SQL Development
    Replies: 16
    Last Post: June 8th, 2008, 10:30 PM
  4. Using AJAX Auto Complete Extender with Database
    By richyrich in forum .Net Code Samples
    Replies: 0
    Last Post: March 26th, 2008, 07:59 AM
  5. Dynamic Content in AJAX Extender
    By richyrich in forum .Net Development
    Replies: 3
    Last Post: March 17th, 2008, 12:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO