I have a small piece of code that calls the database via an AJAX call and returns an XML string that is looped over by jQuery.
This works fine in firefox but will not work in IE11.
I duplicated the issue in JSFiddle but hardcoding the XML string that would have been returned from the AJAX call.
// Define our vars
var fieldIDsArray = Array(),
data = "<root><results><dashboardID>77</dashboardID><dashboardOwner>Q123</dashboardOwner><logic><data><fieldID>13</fieldID><fields><field><fieldTitle>Project Created in Last x Days</fieldTitle><queryField>daysSinceCreation</queryField><allowMultiple>0</allowMultiple><isPeople>0</isPeople><isDate>0</isDate><isSelect>0</isSelect><isInput>1</isInput><placeholder>Project Created in Last x Days</placeholder><span>4</span><values><data><value>30</value></data></values></field></fields></data><data><fieldID>25</fieldID><fields><field><fieldTitle>Project Impacted Ops Locations</fieldTitle><queryField>impactedOpsLocationsXML</queryField><allowMultiple>1</allowMultiple><isPeople>0</isPeople><isDate>0</isDate><isSelect>1</isSelect><isInput>0</isInput><placeholder>Select one or more Impacted Ops Locations</placeholder><span>8</span><selectOptions>initiativeLocations</selectOptions><values><data><value>Berlin</value></data></values></field></fields></data></logic><sorting><logic><dashboardID>77</dashboardID><fieldID>8</fieldID><sort>ASC</sort><order>1</order><fieldName>Project Creation Date</fieldName></logic></sorting></results></root>",
output = '';
// First, we need to loop over all of the fields and load them onto the page
$(data)
.find('logic>data')
.each(function () {
// Define our parent data
parent = $(this);
// Add our fields to an array
fieldIDsArray.push($(parent)
.find('fieldID')
.text());
});
// Pass the array of field ID's to our function to re-create the inputs the user selected
selectLogic(fieldIDsArray, data);
// Function to receive data
function selectLogic(array, data) {
// Loop over the array
$(array)
.each(function () {
output += this + ' <br />';
});
// Append the results
$('[name=results]')
.empty()
.append(output);
}
Fiddle: https://jsfiddle.net/3qc01bpb/
Any idea why this piece of code would not work in IE11 but run fine in firefox?