Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

grabbing a single value / js & ajax

Status
Not open for further replies.

snowboardr

Programmer
Joined
Feb 22, 2002
Messages
1,401
Location
PH
I know how to show a file another file using ajax, but I am unsure how to grab a single value from the script/database and then use that value in a javascript value? Should i just pull the value and place it in a div, and call the contents?

Jason
 
As you have suggested, placing the value into a div would do the trick. Alternatively you could just return the value (no markup at all) and then get the value from responseText.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
There's is nothing magic about what is returned from a program called via "ajax" call (XMLHTTPReqest, or whatever). You can return anything your heart desires. That can be XML, a javascript object (google JSON), a simple string, or a single value. It doesn't matter at all WHAT you return, so long as you know what is being returned and know what to do with it. I have a program called via XMLHTTPRequest that returns an entire record set in JavaScript Object Notation, and I have another that returns only a 1 or a 0.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top