webdesign:head_rush_ajax_appendix
差異處
這裏顯示兩個版本的差異處。
| 兩邊的前次修訂版前次修改 下次修改 | 前次修改 | ||
| webdesign:head_rush_ajax_appendix [2007/03/04 17:50] – wenpei | webdesign:head_rush_ajax_appendix [2007/03/04 18:00] (目前版本) – wenpei | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| ====== Head Rush Ajax 讀書筆記 ====== | ====== Head Rush Ajax 讀書筆記 ====== | ||
| - | ===== Chapter Five ===== | + | ===== Appendix 1 ===== |
| - | Ajax 工具包 | + | ===== Ajax 工具包 |
| ==== Prototype ==== | ==== Prototype ==== | ||
| http:// | http:// | ||
| 行 59: | 行 59: | ||
| </ | </ | ||
| - | JavaScript 程式庫,建立使用者介面。 | + | ===== JavaScript 程式庫,建立使用者介面。 |
| ==== script.aculo.us ==== | ==== script.aculo.us ==== | ||
| http:// | http:// | ||
| 行 75: | 行 74: | ||
| <script type=" | <script type=" | ||
| + | ===== JSON-PHP ===== | ||
| + | http:// | ||
| + | |||
| + | < | ||
| + | require_once(' | ||
| + | $json = new Services_JSON(); | ||
| + | |||
| + | $order1 = array(' | ||
| + | ' | ||
| + | $order2 = array(' | ||
| + | ' | ||
| + | |||
| + | $orders = array(' | ||
| + | $output = $json-> | ||
| + | print($output); | ||
| + | </ | ||
| + | |||
| + | ===== JSON 剖析器 ===== | ||
| + | eval() 直接執行伺服器傳回來的 JSON 回應,沒有考慮到安全問題。 | ||
| + | |||
| + | 使用 JSON 剖析器,避免在 JavaScript 中使用 eval()。 | ||
| + | |||
| + | http:// | ||
| + | |||
| + | var jsonData = JSON.parse(request.resonseText); | ||
| + | |||
| + | JSON 剖析器只接受字串輸入,JSON.parse() 將伺服器回應字串當參數,轉變成物件。 | ||
webdesign/head_rush_ajax_appendix.1173001823.txt.gz · 上一次變更: (外部編輯)
