Changeset 10729
- Timestamp:
- 08/07/08 08:52:04 (4 months ago)
- Files:
-
- doc/branches/1.1/book/11-Ajax-Integration.txt (modified) (3 diffs)
- doc/branches/1.2/book/11-Ajax-Integration.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
doc/branches/1.1/book/11-Ajax-Integration.txt
r10584 r10729 619 619 ") ?> 620 620 621 The `complete` callback has access t he ajax response and can pass it to a third-party function. This custom `updateJSON()` function iterates over the JSON obtained from the response via `responseJSON` and for each member of the array, updates the element named by the first parameter with the content of the second parameter.621 The `complete` callback has access to the Ajax response and can pass it to a third-party function. This custom `updateJSON()` function iterates over the JSON obtained from the response via `responseJSON` and for each member of the array, updates the element named by the first parameter with the content of the second parameter. 622 622 623 623 Listing 11-29 shows how the `publishing/refresh` action can return a JSON response. … … 635 635 } 636 636 637 Using the `application/json` content type allows Prototype to automatically evaluate the JSON passed as body of the response, which is preferred as ofreturning it via the header, because the HTTP header is limited in size and some browsers struggle with responses that do not have a body.637 Using the `application/json` content type allows Prototype to automatically evaluate the JSON passed as the body of the response, which is preferred to returning it via the header, because the HTTP header is limited in size and some browsers struggle with responses that do not have a body. 638 638 By using `->renderText()` the template file is not used, resulting in better performance. 639 639 … … 641 641 642 642 >**TIP** 643 >Since version 5.2, PHP offers two functions, `json_encode()` and `json_decode()`, that allow you to convert an array between the PHP syntax and the JSON syntax, and vice versa ([http://www.php.net/manual/en/ref.json.php](http://www.php.net/manual/en/ref.json.php)). These facilitate the integration of JSON arrays and Ajax in general. 644 >This would enable to use of a more PHP like code: 643 >Since version 5.2, PHP offers two functions, `json_encode()` and `json_decode()`, that allow you to convert an array between the PHP syntax and the JSON syntax, and vice versa ([http://www.php.net/manual/en/ref.json.php](http://www.php.net/manual/en/ref.json.php)). These facilitate the integration of JSON arrays (and Ajax in general) and enable the use of more readable native PHP code: 645 644 > 646 645 > [php] doc/branches/1.2/book/11-Ajax-Integration.txt
r10584 r10729 619 619 ") ?> 620 620 621 The `complete` callback has access t he ajax response and can pass it to a third-party function. This custom `updateJSON()` function iterates over the JSON obtained from the response via `responseJSON` and for each member of the array, updates the element named by the first parameter with the content of the second parameter.621 The `complete` callback has access to the Ajax response and can pass it to a third-party function. This custom `updateJSON()` function iterates over the JSON obtained from the response via `responseJSON` and for each member of the array, updates the element named by the first parameter with the content of the second parameter. 622 622 623 623 Listing 11-29 shows how the `publishing/refresh` action can return a JSON response. … … 635 635 } 636 636 637 Using the `application/json` content type allows Prototype to automatically evaluate the JSON passed as body of the response, which is preferred as ofreturning it via the header, because the HTTP header is limited in size and some browsers struggle with responses that do not have a body.637 Using the `application/json` content type allows Prototype to automatically evaluate the JSON passed as the body of the response, which is preferred to returning it via the header, because the HTTP header is limited in size and some browsers struggle with responses that do not have a body. 638 638 By using `->renderText()` the template file is not used, resulting in better performance. 639 639 … … 641 641 642 642 >**TIP** 643 >Since version 5.2, PHP offers two functions, `json_encode()` and `json_decode()`, that allow you to convert an array between the PHP syntax and the JSON syntax, and vice versa ([http://www.php.net/manual/en/ref.json.php](http://www.php.net/manual/en/ref.json.php)). These facilitate the integration of JSON arrays and Ajax in general. 644 >This would enable to use of a more PHP like code: 643 >Since version 5.2, PHP offers two functions, `json_encode()` and `json_decode()`, that allow you to convert an array between the PHP syntax and the JSON syntax, and vice versa ([http://www.php.net/manual/en/ref.json.php](http://www.php.net/manual/en/ref.json.php)). These facilitate the integration of JSON arrays (and Ajax in general) and enable the use of more readable native PHP code: 645 644 > 646 645 > [php]