[問題]框架頁執行ajax後發生問題
小妹在寫ajax時發生了一些問題
畫面只是一般的框架頁
左邊放連結,右邊就放連結的網頁
一開始都沒有問題
但我的網頁只要執行過ajax後
左邊點選連結時不會在右邊顯示
而是會開新網頁
ajax的部分程式如下
function getstudata()
{
if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
{
name = encodeURIComponent(document.getElementById("a_stu_no").value);
xmlHttp.open("GET", "studata.php?name=" + name, true);
xmlHttp.onreadystatechange = handleServerResponse;
xmlHttp.send(null);
}
}
function handleServerResponse()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
xmlResponse = xmlHttp.responseXML;
xmlDocumentElement = xmlResponse.documentElement;
Message = xmlDocumentElement.firstChild.data;
}
else
{
alert("There was a problem accessing the server: " + xmlHttp.statusText);
}
}
}
請問一下是不是我有地方寫錯呢?
謝謝大家
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.171.118.204
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章