Ajax通用模板實現(xiàn)代碼
更新時間:2011年12月19日 23:46:06 作者:
Ajax通用模板實現(xiàn)代碼,需要的朋友可以參考下。
復(fù)制代碼 代碼如下:
<script type="text/javascript">
var xmlHttp;
function creatXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHttp");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function startRequest() {
creatXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET", "simpleResponse.xml", true);
xmlHttp.send(null);
}
function handleStateChange() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
// document.getElementById("results").innerHTML = xmlHttp.responseText;
// alert("The server replied with:" + xmlHttp.responseText);
}
}
}
</script>
相關(guān)文章
JavaScript基于Ajax實現(xiàn)不刷新在網(wǎng)頁上動態(tài)顯示文件內(nèi)容
這篇文章主要介紹了JavaScript基于Ajax實現(xiàn)不刷新在網(wǎng)頁上動態(tài)顯示文件內(nèi)容,可實現(xiàn)實時顯示服務(wù)器上txt文件內(nèi)容的功能,是Ajax基本應(yīng)用,具有一定參考借鑒價值,需要的朋友可以參考下2015-03-03
使用Ajax實時檢測"用戶名、郵箱等"是否已經(jīng)存在
這篇文章主要介紹了使用Ajax實時檢測"用戶名、郵箱等"是否已經(jīng)存在,需要的朋友可以參考下2015-01-01

