Age old problem probably but about to pull my hair out.
I have an xml file being loaded from the same folder as the html file.
JS Code:
function onxmlReceived(data) {
if(!($.browser.msie)) {//for Non IE Browsers
var xmlData = data;
}else {// For IE
var xmlData = new ActiveXObject("Microsoft.XMLDOM");
xmlData.async = false;
xmlData.loadXML(data);
}
alert ("Got: "+xmlData);
alert("Got: "+data);
$(xmlData).find('energyDM').each(function(){
d1=[];
for(var i = 0; i < Rec_Count; i++) {
something();
}
});
}
function graphUpdate(){
$.ajax({
url: "EnergyDM.xml",
type:"GET",
dataType: ($.browser.msie) ? "text" : "XML",
success: onxmlReceived,
error: function(xhr, textStatus, errorThrown)
{
alert(textStatus + ' ' + errorThrown);
}
});
}
I have two alerts. In IE,
alert ("Got: "+xmlData); gives Got: in the alert window, where as
alert("Got: "+data); Gives Got: + the proper xml content in an alert window
And since the xml is not loaded, I cant access the nodes in the something() section
XML file
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <response>
- <energyDM>
<edNum>1000</edNum>
<TMF>UTC</TMF>
<pm339>0.166</pm339><pm340>1327449209</pm340>
<ed0000>0.148</ed0000>
<et0000>1327449510</et0000>
.
.
alert("Got: "+data); correctly shows this XML content.
Am I missing something? I would appreciate any clues. Thanks
I figured out something as to why it is not working. Inside the something() function, I had for(var i = 0; i < Rec_Count; i++) { if(i < 10) { d1.push([(parseInt($(this).find(‘et’ + (‘0000’ + i).substr(-4))*1000, parseFloat($(this).find(‘ed’+(‘0000’ + i).substr(-4)).text())]); } } I changed this to for(var i = 0; i < Rec_Count; i++) { if(i < 10) { d1.push([(parseInt($(this).find(‘et000’+i).text(),10))*1000, parseFloat($(this).find(‘ed000’+i).text())]); } } it works in IE.