English 中文(简体)
为什么在 jAJAX反应中需要CDATA?
原标题:Why is CDATA needed for html in jQuery AJAX response?

我有传承Xml的雅氏功能。 在xml,有一张桌子和其他一些Xml元素。 我尝试了几种办法,以摘取html表格,以插入网页,但被告知我需要把表格与《空运公约》一起总结。 然后,我可以使用<代码>,$container.html(respose.find ( table-data ).text(),使其发挥作用。

我要问的是:

  1. Is this the only way to do this?
  2. Why is CDATA needed? I thought xhtml should co-exists with xml nicely.

EDIT:

Here is my xml response, I have checked with Firebug and is valid:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<response>
  <data>
    <li class="item x1">
       <p class="l1"><b class="view">0 views</b></p>
    </li>
    <li class="item x2">
      <p class="l1"><b class="view">0 views</b></p>
    </li>
  </data>
  <total_count>101387</total_count>
  <total_pages>4056</total_pages>
  <pagesize>25</pagesize>
</response>
问题回答

CDATA sections are commonly used for scripting language content and sample XML and HTML content. Check for more details here http://msdn.microsoft.com/en-us/library/ms256076.aspx

Try with jQuery.parseXML more details http://api.jquery.com/jQuery.parseXML/ and this Complete Code http://www.vagrantradio.com/2009/10/how-to-parse-xml-using-jquery-and-ajax.html





相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签