Thread: AJAX FTW!!!
View Single Post
Old 08-28-08, 02:17 PM   #13
Ngemu Mod
Join Date: Jul 2003
Location: Fresno, CA
Posts: 1,886
Default Re: AJAX FTW!!!

Originally Posted by t3hl33td4rg0n View Post

User input >> XMLHttpRequest (fxhr) >> PHP Script (Make JSON output in plain text and send to fxhr.responseText) >> js script, parse JSON into DOM >> output to targeted elements via JS.
You'll need to use the Javascript eval(); function to evaluate the JSON string into a javascript object. Essentially, you'll:

// if responseText is {'state':'CA','zip':'93727'}
var jsobj = eval(fxhr.responseText);

// jsobj.state ==  'CA'
// == '93727'
JSON Strings can also evaluate into arrays of variables and objects.
[i7 2600k @4.4ghertz][2x4 GB DDR3 1600][EVGA GTX570 1.280GB SC][EVGA GTX460 physx][Asrock Extreme7 Gen3 Z68][2xSeagate 160 Gb SATA HD raid0][Seagate 250 GB SATA2 HD][Sony Bravia 40' 1080p LCD HDTV][NEC 3520a DVD+-DLw][Windows 7 Ultimate x64][Rosewill 1000w]
fivefeet8 is offline   Reply With Quote