ajax中xmlHttpRequest.responseText返回值問題
1 回答

牛魔王的故事
TA貢獻1830條經(jīng)驗 獲得超3個贊
用ajax請求時候:
響應(yīng)的數(shù)據(jù)類型由ajax設(shè)置的接受數(shù)據(jù)方式?jīng)Q定:
responseText決定響應(yīng)的數(shù)據(jù)類型是文本;
responseXML決定響應(yīng)的數(shù)據(jù)類型xml文檔。當(dāng)返回xml文檔時候Servlet一定要設(shè)置response.setContentType("text/xml;charset=utf-8");根據(jù)是否需要緩存,可以設(shè)置response.setHeader("Cache-control", "no-cache");
- 1 回答
- 0 關(guān)注
- 530 瀏覽
添加回答
舉報
0/150
提交
取消