naoya.net@Wiki
Ajax+Webサービス
最終更新:
匿名ユーザー
-
view
XMLHttpRequestオブジェクト生成
try {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
xmlHttp=new XMLHttpRequest();
}
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
xmlHttp=new XMLHttpRequest();
}
POST
xmlHttp.Open("POST","/AjaxTestXML/Service1.asmx/GetPIMITB","HTTP/1.1");
xmlHttp.SetRequestHeader("Host", "localhost");
xmlHttp.SetRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.SetRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.SetRequestHeader("Content-Length", "5");
xmlHttp.send("orcd=949868&ybcd=" + document.fm.ybcd.value);
xmlHttp.send("orcd=949868&ybcd=" + document.fm.ybcd.value);
webサービスの戻り値がDataSetの場合
var aData =
xmlHttp.responseXML.selectSingleNode("DataSet/diffgr:diffgram/NewDataSet");
xmlHttp.responseXML.selectSingleNode("DataSet/diffgr:diffgram/NewDataSet");
var data = aData.childNodes;
for (i =0; i < data.length; i++) {
data[i].childNodes[0].firstChild.nodeValue
data[i].childNodes[1].firstChild.nodeValue
}
for (i =0; i < data.length; i++) {
data[i].childNodes[0].firstChild.nodeValue
data[i].childNodes[1].firstChild.nodeValue
}