Chapter 9.1.2. Ajax Requests/JSON Responses

But sometimes you need to update several different portions of the page, or you want to trigger some kind of visual effect, or you just want to pass a value in to your JavaScript from the server, where you can process it in any way you like.

By far, the easiest way to do this is to use JSON. JSON stands for JavaScript Object Notation, which is just a fancy way of saying that what you pass back is a collection of JavaScript objects in the form of a string. JSON is a subset of JavaScript, so you can eval a JSON response from the server and get an object or set of objects back.

MochiKit provides an easy way to get JSON from the server via loadJSONDoc(), and WhatWhat Status uses this kind of thing, too. ...

Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.