Using AJAX to pull data from a dynamically generated XML using .NET. Using simple jQuery Ajax:
$.ajax({
type: "GET",
url: "/test/dynamic.aspx",
success: function(xml) {
var itemTitleSrc = $(xml).find('ItemName').text();
alert(itemTitleSrc);
}
});
In Firefox, Chrome, Safari, the alert brings back all of the strings associated with the node i am telling it to find. In IE, the alert box comes in blank. If I switch out the dynamic url and change it to a static XML and search for a node, both browsers come back with the same info.
My question is, could there be some kind of permissions set to the dynamic XML that IE is following and refusing to bring back the desired information.
On another quick note, if I create an alert for the data itself, like so:
alert(xml);
Both browsers, return the same data. It only seems that IE refuses to bring info either from a dynamically created XML and/or only when I search for a particular node.
Anyone with ideas?
First of all try to repeat the test with additional parameter
cache: falseof jQuery.ajax.It would be also interesting to change
successfunction tofunction(xml, textStatus, xhr)and displayxhr.responseTextwithalert(xhr.responseText). The parameterdataType:"xml"can be also helpful depending whether you set content-type in the server response.UPDATED: If you do receive the xml data in the IE and can only not load XML data, then you should follow the recommendation from the jQuery Documentation. You should test whether the current browser is IE. For IE you should load the data as text:
dataType: "text"and then inside ofsuccesshandler convert the xml text toActiveXObject("Microsoft.XMLDOM")object.