ajax 與中文
20080825 shyong
今天在試寫第一個用 php 程序的簡單 ajax 應用時,在中文部分一直傳回亂碼,後來查 Google 才知,因為編碼原因,
- Server 端傳回時必須先告知編碼 ,即先送出 : header('Content-Type:text/html;charset=big5');
- Client 端傳送須先 URI 編碼 : var url = "url.php?name=" + encodeURIComponent(value);
Server 端測試可以,Client 等有用到再試 (閱讀全文)