Have prototype.js automatically eval JSON responses
Wednesday, February 20th, 2008JSON is the perfect format for passing data from a server to JavaScript. With the prototype.js the JSON string sent by the server is automatically evaluated to a native JavaScript datatype. In order to do this you need to pass the data back with a content-type of application/json.
Step 1
First we’ll need to set up a script (PHP in this case) on the server to return a JSON string and specify the content type. This is easily done using the following code: (more…)
