You want part of your page to update with server-side data without reloading the whole page. For example, you want to populate a list with search results.
In Example 13-60, the search( ) function uses Dojo's dojo.io.bind( ) function to send a request back to the server, passing whatever's in the text box as the q query string parameter. The other arguments to dojo.io.bind( ) indicate that a JSON response is expected, and when the request arrives, it should be passed to the showResults( ) function.
The showResults( ) function, in turn, takes those results and builds an HTML list out of them. Once the list has been built up, it sets the content of the output <div/> to contain that HTML.
Example 13-61 is the familiar part of this triumvirate. It's very similar to any "search the database for some stuff based on user input" PHP script, except for how it returns results. Instead of printing HTML, it uses the techniques described in 13.15 to send back an uncacheable JSON response.
13.16.4. See Also