Posts

Showing posts with the label prototype

Prototype, JSON and Appengine

I am using prototype in a Google Appengine project, and while it worked on my development machine, after deploying it onto the Google infrastructure prototype wasn't parsing the JSON responses anymore. In my code, I was returning the JSON in the response text (as opposed to using X-JSON response header). The Content-Type response header was set as application/json and my javascript code used Ajax.Request() with the parameter evalJSON:true so as to parse the response text. Running locally with the dev_appserver.py everything worked okay. However when running the deployed app, the Content-Type header was no longer being set - meaning that prototype would never parse the response text. I'm not sure why Content-Type doesn't get set when running on the Google infrastructure yet it works on the development server. But, luckily when using Ajax.Request, you can specify evalJSON:'force' so that prototype parses the response regardless of the content-type. Server ajax respons...