DeveloperBarn Forums

DeveloperBarn

Programming & IT forum

ajax return undefined

This is a discussion on ajax return undefined within the JavaScript Programming forums, part of the Programming & Scripting category; hi i m using ajax like this Code: var sTarget = 'EmergencyDocCreation_CheckForInvoiceDuplicate.asp'; sTarget += '?SupplierID=<%=lSupplierID%>'; sTarget += '&DocumentRef=' + escape($('txtDocumentRef').value); ...

Go Back   DeveloperBarn Forums > Programming & Scripting > JavaScript Programming

  #1  
Old November 20th, 2008, 09:12 AM
guddu's Avatar
Barn Enthusiast

 
Join Date: Jul 2008
Location: Oxford UK
Posts: 269
Thanks: 19
Thanked 3 Times in 2 Posts
Rep Power: 1
guddu is on a distinguished road
Default 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
Reply With Quote
  #2  
Old November 20th, 2008, 09:21 AM
jmurrayhead's Avatar
The Barnfather


 
Join Date: Mar 2008
Location: Washington, D.C.
Posts: 1,566
Thanks: 39
Thanked 166 Times in 157 Posts
Blog Entries: 7
Rep Power: 10
jmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to behold
Default

What exactly are you trying to do with this? Why use AJAX to display a JavaScript alert?
__________________
jmurrayhead
If you agree with me... click the icon!
If my post solved your problem, click the button in the lower right-hand corner of the post.

If you like it here...throw us a few bones to help
support us.

Join our Folding team: DeveloperBarn Folding

Reply With Quote
  #3  
Old November 20th, 2008, 09:30 AM
guddu's Avatar
Barn Enthusiast

 
Join Date: Jul 2008
Location: Oxford UK
Posts: 269
Thanks: 19
Thanked 3 Times in 2 Posts
Rep Power: 1
guddu is on a distinguished road
Default

actaully i m checking my ajax code is working or not .
Reply With Quote
  #4  
Old November 20th, 2008, 09:35 AM
jmurrayhead's Avatar
The Barnfather


 
Join Date: Mar 2008
Location: Washington, D.C.
Posts: 1,566
Thanks: 39
Thanked 166 Times in 157 Posts
Blog Entries: 7
Rep Power: 10
jmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to behold
Default

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?
Reply With Quote
  #5  
Old November 20th, 2008, 09:38 AM
guddu's Avatar
Barn Enthusiast

 
Join Date: Jul 2008
Location: Oxford UK
Posts: 269
Thanks: 19
Thanked 3 Times in 2 Posts
Rep Power: 1
guddu is on a distinguished road
Default

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.
Reply With Quote
  #6  
Old November 20th, 2008, 09:42 AM
jmurrayhead's Avatar
The Barnfather


 
Join Date: Mar 2008
Location: Washington, D.C.
Posts: 1,566
Thanks: 39
Thanked 166 Times in 157 Posts
Blog Entries: 7
Rep Power: 10
jmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to behold
Default

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.
Reply With Quote
  #7  
Old November 20th, 2008, 09:44 AM
guddu's Avatar
Barn Enthusiast

 
Join Date: Jul 2008
Location: Oxford UK
Posts: 269
Thanks: 19
Thanked 3 Times in 2 Posts
Rep Power: 1
guddu is on a distinguished road
Default

here i m opening request.i dont want to use xmlhttp request.
var ajaxRequest = new Ajax.Request(sTarget,
{
evalScripts: true,
asynchronous: false
}
Reply With Quote
  #8  
Old November 20th, 2008, 10:11 AM
jmurrayhead's Avatar
The Barnfather


 
Join Date: Mar 2008
Location: Washington, D.C.
Posts: 1,566
Thanks: 39
Thanked 166 Times in 157 Posts
Blog Entries: 7
Rep Power: 10
jmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to behold
Default

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');
  } 
});
Reply With Quote
  #9  
Old November 20th, 2008, 10:25 AM
guddu's Avatar
Barn Enthusiast

 
Join Date: Jul 2008
Location: Oxford UK
Posts: 269
Thanks: 19
Thanked 3 Times in 2 Posts
Rep Power: 1
guddu is on a distinguished road
Default

object expected error.when i put your code as it is.did u run at your end.
Reply With Quote
  #10  
Old November 20th, 2008, 10:54 AM
jmurrayhead's Avatar
The Barnfather


 
Join Date: Mar 2008
Location: Washington, D.C.
Posts: 1,566
Thanks: 39
Thanked 166 Times in 157 Posts
Blog Entries: 7
Rep Power: 10
jmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to beholdjmurrayhead is a splendid one to behold
Default

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?
Reply With Quote
Reply

  DeveloperBarn Forums > Programming & Scripting > JavaScript Programming

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

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


All times are GMT -4. The time now is 08:31 PM.


Copyright ©2008-2009, DeveloperBarn

Content Relevant URLs by vBSEO 3.3.0