使用者工具

網站工具


webdesign:head_rush_ajax_appendix

差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

兩邊的前次修訂版前次修改
下次修改
前次修改
webdesign:head_rush_ajax_appendix [2007/03/04 17:50] – wenpeiwebdesign: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://prototype.conio.net http://prototype.conio.net
行 59: 行 59:
 </code> </code>
  
-JavaScript 程式庫,建立使用者介面。 +===== JavaScript 程式庫,建立使用者介面。 =====
 ==== script.aculo.us ==== ==== script.aculo.us ====
 http://script.aculo.us http://script.aculo.us
行 75: 行 74:
   <script type="text/javascript" src="util.js"> </script>   <script type="text/javascript" src="util.js"> </script>
  
 +===== JSON-PHP =====
 +http://mike.teczno.com/json.html
 +
 +<code>
 +require_once('JSON.php');
 +$json = new Services_JSON();
 +
 +$order1 = array('name' => 'SARS',
 +                'age' => 18 );
 +$order2 = array('name' => 'Kimble',
 +                'age' => 17 );
 +
 +$orders = array('coffeeOrders' => array($order1, $order2) );
 +$output = $json->encode($orders);
 +print($output);
 +</code>
 +
 +===== JSON 剖析器 =====
 +eval() 直接執行伺服器傳回來的 JSON 回應,沒有考慮到安全問題。
 +
 +使用 JSON 剖析器,避免在 JavaScript 中使用 eval()。
 +
 +http://www.json.org/js.html
 +
 +  var jsonData = JSON.parse(request.resonseText);
 +
 +JSON 剖析器只接受字串輸入,JSON.parse() 將伺服器回應字串當參數,轉變成物件。
webdesign/head_rush_ajax_appendix.1173001823.txt.gz · 上一次變更: (外部編輯)