I really don't understand why I get a different response from xhrPost using Dojo. It works fine for IE8, and XML can be read, but it works differently in Firefox, and there is no such attribute as "serverResponse.results [0] .xml" - see below:
var serverResponse = dojo.xhrPost(xhrArgs);
serverResponse.results[0].xml
how do you get into IE8.
Does anyone know how to properly handle responses in Firefox when using xhrPost. Greetings.
var message = '<?xml version="1.0" encoding="utf-8"?>' +
'<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">' +
'<soap12:Body>' +
'<MineSearch xmlns="http://localhost/">' +
'<x>' + inPoint.x + '</x>' +
'<y>' + inPoint.y + '</y>' +
'<buffer>' + buffer + '</buffer>' +
'</MineSearch>' +
'</soap12:Body>' +
'</soap12:Envelope>';
var xhrArgs = { url: "http://localhost/ApplicationServices.asmx?op=MineSearch",
postData: message,
headers: { "Content-Type": "application/soap+xml" },
handleAs: "xml",
sync: true,
load: function(data) {
dojo.byId("footer").innerHTML = "Message posted.";
},
error: function(error) {
dojo.byId("footer").innerHTML = "Message error.";
}
}
var serverResponse = dojo.xhrPost(xhrArgs);
var xmldata = serverResponse.results[0].xml;
var xmlDoc;
if (window.DOMParser) {
parser = new DOMParser();
xmlDoc = parser.parseFromString(serverResponse.results[0], "text/xml");
}
else
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.loadXML(xmldata);
}
source
share