2018年3月21日 星期三

[PHP]Jquery ajax

小心使用 Ajax 防止 Bug 產生 https://dotblogs.com.tw/jasonyah/2013/06/02/use-ajax-you-need-to-be-care
$.ajax({ url: '', // url位置 type: 'post', // post/get data: { querytag: data }, // 輸入的資料 error: function (xhr) { }, // 錯誤後執行的函數 success: function (response) { }// 成功後要執行的函數 });

[PHP]JQUERY

以jQuery實現可編輯 http://blog.darkthread.net/post-2011-06-22-editable-table-with-jquery.aspx 神奇的jQuery Selector http://www.darkthread.net/jQuery/Tutorial04/default.htm 如何撰寫有效率的CSS選擇器(CSS Selector) http://www.mrmu.com.tw/2011/10/11/writing-efficient-css-selectors/

[PHP]JSON相關

回傳JSON 快速取得物件中的資料 若想要快速取得物件中的資料, 則可以參考 JQuery 的 $.each() 函數, 例如要取得 JSON 回傳資料中的APPLIER 物件. 程式可以這樣寫 $.each(userData, function(i, val){ if (i=="APPLIER"){ $.each(val[0] , function(applier, a_val){ alert("key:"+applier+" , value:"+a_val) }); } }); json_encode() 使用該函式將 PHP 陣列(Array)和物件(Object),編碼成 JSON 字串。 json_decode() 使用該函式將 JSON 格式的字串進行解碼,轉換為 PHP 變數。 http://www.smalljacky.com/programming-language/php/php-json-teaching/