xmlHttp.open xmlHttp.responseText討論

例子:function report(geometry){
var wktGet = myGeometryToWKT(geometry);
   if (window.XMLHttpRequest) {
      xmlHttp = new XMLHttpRequest();                  //FireFox、Opera等瀏覽器支持的創建方式
   } else {
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");//IE瀏覽器支持的創建方式
   }
   xmlHttp.onreadystatechange = writeSource;                   //設置回調函數
   xmlHttp.open("GET", "innerTable.html", true);
   xmlHttp.send(null);
}


function writeSource() {
   if (xmlHttp.readyState == 4) {
       alertWin('違法用地舉報', xmlHttp.responseText, 400, 450);
   }
}


1、xmlHttp.open(method,url,boolean,userName,userPassword)

method包括 get、post、put、propfind (大小寫不敏感)

url:即地址  可以使絕對路徑也可以是相對路徑

boolean:true/false  true:執行回調函數  false:不執行回調函數

userName/userPassword:針對服務器是否設置登錄驗證

2、xmlHttp.responseText

返回的是頁面查看源代碼的內容

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章