熱門標簽:海南銀行智能外呼系統(tǒng)商家許昌智能電銷機器人公司澳大利亞城市地圖標注電銷機器人違法了嗎上海浦東騰訊地圖標注位置姜堰電銷機器人遼寧銀行智能外呼系統(tǒng)遼寧正規(guī)電銷機器人辰溪地圖標注本示例主要演示如何操作XMLHttpRequest..... XMLHttpRequest 簡介 要真正實現(xiàn)這種絢麗的奇跡,必須非常熟悉一個 JavaScript 對象,即 XMLHttpRequest。這個小小的對象實際上已經(jīng)在幾種瀏覽器中存在一段時間了,它是本專欄今后幾個月中要介紹的 Web 2.0、Ajax 和大部分其他內(nèi)容的核心。為了讓您快速地大體了解它,下面給出將要用于該對象的很少的幾個 方法和屬性。 open():建立到服務器的新請求。 send():向服務器發(fā)送請求。 abort():退出當前請求。 readyState:提供當前 HTML 的就緒狀態(tài)。 responseText:服務器返回的請求響應文本。 客戶端HTML代碼:
復制代碼 代碼如下:
script language="javascript" type="text/javascript"> var xmlHttp = false; try { xmlHttp = new XMLHttpRequest(); } catch (trymicrosoft) { try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (othermicrosoft) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { xmlHttp = false; } } } if (!xmlHttp) alert("Error initializing XMLHttpRequest!"); function getCustomerInfo() { var phone = document.getElementById("qq").value; var url = "demo2.asp?qq=" + escape(phone); xmlHttp.open("GET", url, true); xmlHttp.onreadystatechange = updatePage; xmlHttp.send(null); } function updatePage() { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { var response = xmlHttp.responseText.split("|"); document.getElementById("message").innerHTML = '號碼是:' + response[0] + 'br>姓名是:' + response[1] + 'br>性別是:' + response[2] + 'br>職務是:' + response[3]; alert("響應服務完成!"); } else if (xmlHttp.status == 404) { alert('請求的網(wǎng)址不存在!'); } else { alert('錯誤:錯誤代碼為:' + xmlHttp.status); } } } /script> input id="qq" type="text" onchange="getCustomerInfo()" /> div id="message">請嘗試輸入我的QQ號碼:178010108,會看到返回的詳細資料./div>
服務端程序代碼:
復制代碼 代碼如下:
% Response.ContentType = "text/xml" Response.CharSet = "GB2312" if request("qq") = "178010108" then response.write "178010108|阿里西西|男|ASP技術" else response.write "這個QQ號碼是空號哦" end if %>