content of <![CDATA[...]]> after ajax call empty in Sa

content of <![CDATA[...]]> after ajax call empty in Sa

Hi all,

I do a ajax call and get an xml file in the respons. When I use $(xml).find(tagname).text() I should get the content of all the tags with that tagname. From both the tags that have plain content and tags that have its content wrapped in a <![CDATA[...]]> block

It works fine in IE6, IE7 and FF, but in Safari the result of the text() call always returns an empty string if the content is inside a <![CDATA[...]]> block.

Here is my ajax call:

jQuery.ajax({   url: 'test.xml'
               ,dataType: "text/xml"
               ,type: 'GET'
               ,success: handleResultSuccess
               ,error: handleResultError
});


And the xml

<?xml version="1.0" encoding="UTF-8"?>
<led>
   <ledImg><![CDATA[exampleLed1.jpg]]></ledImg>
   <brand><![CDATA[Ledwaves (oem)]]></brand>
</led>



and the way I get the content from the 'ledImg' tag

$(xml).find('ledImg').text();


I tried other datTypes, html() instead of text(), but it won't work in safari (and chrome, so I guess it is a webkit error): I keep getting empty results. If I remove the CDATA block it does work.

Any ideas anyone?
    • Topic Participants

    • koen