views:

207

answers:

1

Hi, I have an AJAX query which makes a request and gets some XML back. The XML contains data for a table and a chart. The table works fine but the chart (for FusionCharts) is proving to be problematic. I have it working in FireFox by using

   // For some reason the .text() is not working on this, one solution is to write it to the page'
   // and then read it back again.'
   //'
   var onlyChart = $(jData).find("chart");'


   // Append the xml to the div to hold it'
   //'
   //$( document.getElementById("xmldiv")).append (onlyChart);'
   var xmlDiv = document.getElementById("xmldiv");'
   xmlDiv.innerHTML = "";'
   $(xmldiv).append(onlyChart);'
   alert(xmlDiv.innerHTML);'

   //alert (xmlDiv.innerHTML);'

   // Read the data from the div'
   //'
   var chartFromDiv = document.getElementById('xmldiv').innerHTML;'

this is not ideal, but it does work. Unfortunately it does not work in IE. I need a jQuery function that will put the xml in the chart tags into a variable. I have tried text and just get alot of \n back.

Any help with this would be brilliant.

Thanks

John

A: 

You can try:

   var onlyChart = $(jData).find("chart");

   var xmlDiv = $("#xmldiv");
   xmlDiv.empty().append(onlyChart);

   var chartFromDiv = xmlDiv.html();
Artem Barger
Unfortunately that didn't work. Ideally i'd like to not have to write to the xmlDiv at all, but I can't get the data from the XML object. Any idea why .text doesn't work
JD
Put a sample of your XML data.
Artem Barger