IT Community - Software Programming, Web Development and Technical Support

Why my DB returning nothing when I use AJAX?

This is a discussion on Why my DB returning nothing when I use AJAX? within the ASP and ASP.NET Programming forums, part of the Web Development category; Hi all, I'm new to AJAX. If I do a ajax posting to an asp page that will returns ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > ASP and ASP.NET Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 09-26-2007, 11:16 PM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Question Why my DB returning nothing when I use AJAX?

Hi all,

I'm new to AJAX.


If I do a ajax posting to an asp page that will returns some values from db. And I build a variable "myVar" and do as follows.

Code:
response.write(myVar)
to pass the results back to ajax, then

Code:
http_request.responseText="".
But I'm getting nothing in my ajax responseText.

I'm confusing why I'm getting this?
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-27-2007, 03:21 AM
accer accer is offline
D-Web Sr.Programmer
 
Join Date: Sep 2007
Posts: 175
accer is on a distinguished road
Default Re: Why my DB returning nothing when I use AJAX?

That makes two of us! But then I'm also new to AJAX and still just playing with it . If you figure it out, post here!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-27-2007, 03:27 AM
amansundar amansundar is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 325
amansundar is on a distinguished road
Smile Re: Why my DB returning nothing when I use AJAX?

I think your DB code is in error, or your query returns nothing.

Try this ,

Code:
myVar = "Text Here"
Response.Write(myVar);
__________________
cheers
Aman
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-27-2007, 03:36 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Exclamation Re: Why my DB returning nothing when I use AJAX?

Thanks for the reply.

Actually, I've independently verified that each piece is working. I've narrowed it down to the query string I create that calls the stored Proc on the server. Strangely, both return the same record, but ajax accepts only one:

rsGetDatabasesQ2 = "exec spGetMostCurrentDatabaseStats '" & xServerName & "', '" & xDBName & "'"
^^^ this one I build the string dynam - doesn't work with ajax, but does return the correct recordset.

rsGetDatabasesQ2 = "exec spGetMostCurrentDatabaseStats 'wavedev\wavedev', 'css'"
^^^ this one I explicitly pass the params in - does work with ajax, and returns the correct recordset.

Hmm...I'm stumped.
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 09-28-2007, 12:21 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Question Re: Why my DB returning nothing when I use AJAX?

I've further narrowed it down to the xServerName var in the query string. If I replace it with the value directly, it works. I know the var itself is correct because the process does return valid records form the database when its used.
Ajax sure seems picky about things?
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 09-28-2007, 02:17 AM
amansundar amansundar is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 325
amansundar is on a distinguished road
Smile Re: Why my DB returning nothing when I use AJAX?

There are no "variables" in the query string. There are name/value pairs.

Does the query string have an ampersand in it?


?something=th&is

The "is" will be treated as the second name in the second name/value pair, as if the query sting were like this:

?something=th&anything=is

Try it this way,

?something=th&is
__________________
cheers
Aman
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 09-28-2007, 11:52 PM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Smile Re: Why my DB returning nothing when I use AJAX?

Hi aman!

Any way thnx for your kind reply. I will go thru this way.
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


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

vB 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
how to use ajax in asp.net and how to install ajax in my system vel.m8 ASP and ASP.NET Programming 5 04-08-2008 08:55 PM
Drawback in Ajax senraj PHP Programming 32 03-28-2008 11:54 PM
ajax ursklakshmanan PHP Programming 3 03-17-2008 02:21 AM
why the "InvalidOperationException" error when returning array value in webservice? leoraja8 ASP and ASP.NET Programming 7 11-14-2007 10:39 PM
declare an array of N pointers to functions returning ? sundarraja C and C++ Programming 0 07-25-2007 04:58 AM


All times are GMT -7. The time now is 07:18 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0