包装Ajax的方法:
var getServerProcess = function(method,
callback) {
var soap = "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'><soap:Body>" +
"<ns:" + method + " xmlns:ns='http://webservice.overhaulManage.com/'>" +
"</ns:" + method + "></soap:Body></soap:Envelope>";
$.ajax({
type: "post",
url: methodUrl,
data: soap,
datatype: "xml",
contentType: "text/xml;charset=utf-8",
success: function(data) {
var result = data.getElementsByTagName("return")[0].firstChild.nodeValue;
callback( JSON.parse(result));
},
error: function(msg) {
console.log("Fail:getServerProcess");
}
});
}
var soap = "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'><soap:Body>" +
"<ns:" + method + " xmlns:ns='http://webservice.overhaulManage.com/'>" +
"</ns:" + method + "></soap:Body></soap:Envelope>";
$.ajax({
type: "post",
url: methodUrl,
data: soap,
datatype: "xml",
contentType: "text/xml;charset=utf-8",
success: function(data) {
var result = data.getElementsByTagName("return")[0].firstChild.nodeValue;
callback( JSON.parse(result));
},
error: function(msg) {
console.log("Fail:getServerProcess");
}
});
}
调用方法:
getServerProcess('getProcess',
function(data) {
pageInit( data);
});
pageInit( data);
});