Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery与XML_Jquery_Xml_Internet Explorer_Firefox - Fatal编程技术网

jQuery与XML

jQuery与XML,jquery,xml,internet-explorer,firefox,Jquery,Xml,Internet Explorer,Firefox,我有一个AJAX查询,它发出请求并返回一些XML。XML包含表和图表的数据。该表运行良好,但该图表(用于FusionCharts)被证明存在问题。 我在FireFox中使用 // 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 = $(

我有一个AJAX查询,它发出请求并返回一些XML。XML包含表和图表的数据。该表运行良好,但该图表(用于FusionCharts)被证明存在问题。 我在FireFox中使用

   // 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;'
这并不理想,但确实有效。不幸的是,它在IE中不起作用。我需要一个jQuery函数,将图表标记中的xml放入变量中。我试过发短信,但收到了很多回复

这方面的任何帮助都会非常出色

谢谢

约翰

你可以试试:

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

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

   var chartFromDiv = xmlDiv.html();

不幸的是,这不起作用。理想情况下,我希望根本不必写入xmlDiv,但我无法从XML对象获取数据。知道为什么.text不起作用吗?请输入XML数据的示例。