[問題] AJAX 在 IE7死掉了
我有一小段網上抓來的CODE。原本在IE6/FF/SAFARI/OPERA都運作正常。
但是IE7上一直無法運作。
IE7告訴我是"發生錯誤,無法完成操作c00ce56e"
上網找了一下是文字編碼的問題。
CODE如下:
<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of JavaScript -
var request = false;
try {
request = new XMLHttpRequest();
} catch (trymicrosoft) {
try {
request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (othermicrosoft) {
try {
request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
request = false;
}
}
}
if (!request)
{alert("無法起始AJAX功能");}
function test(n) {
var eid = n;
var url = "teacherlist.php?eid=" + escape(eid);
request.open("GET", url, true);
request.onreadystatechange = updatePage;
request.send(null);
}
function updatePage() {
if (request.readyState == 4) {
if (request.status == 200) {
var response = request.responseText.split("|");
(好像是上面這行出問題)
if(response[0] == "None")
{var hess = "NO";}
else
{ var hess = "YES";}
var hess = response[0];
document.getElementById("ajdoc").innerHTML = hess;
}
else
alert("status is " + request.status);
}
}
-->
</SCRIPT>
有人能教我怎麼修正嗎
--
小惡魔的家
http://blog.pixnet.net/shiuju/
--
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.124.142.152
→
06/09 20:42, , 1F
06/09 20:42, 1F
→
06/09 22:12, , 2F
06/09 22:12, 2F
→
06/09 22:36, , 3F
06/09 22:36, 3F
→
06/09 22:37, , 4F
06/09 22:37, 4F
→
06/09 22:38, , 5F
06/09 22:38, 5F
→
06/10 08:16, , 6F
06/10 08:16, 6F
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章