Ajax and parse XML using JQuery

Following is a sample of making Ajax call and parsing return XML data using JQuery


$.post(url + '/admin/jq?a=6&id=101' , function(data) {

          // Parse data to XML object
          xmlDoc = $.parseXML(data);

          $(xmlDoc).find('targetLevel').each(function(){
                    alert($(this).text());
           });

});

CDATA Section

A CDATA section allows you to mark a section of text as literal so that it will not be parsed for tags and symbols, but will instead be considered just a string of characters. E.g. if you want to put HTML in an XML document, but you don’t want it parsed, you can embed it in a CDATA section.

<?xml version='1.0' encoding='UTF-8'?> <data> 
<![CDATA[
  <html>
   ....
  </html>
]]>
</data>