Hey,
solution (stupid!): The XML wasn't valid.. I forgot a /. Although I validated it earlier in w3schools, I added one tag and didn't close it properly.
original: I'm parsing an xml file with jQuery. In one node I store a JavaScript function with CDATA:
<action is="javascript"><![CDATA[
alert("Holy Crap!");
]]>
</action>
now I crawled the web for solutions and found out that I need to specify "text/xml" as content-type for $.get() for the CDATA to be processed properly. Making my $.get as follows:
$(document).ready(function() {
$.get("wired.xml", {}, xmlToToolbar, 'text/xml');
});
this still doesn't work. I'm using FF. alerting the xml content will show blank where the CDATA content should have been. If this helps, here is the line I use to retrieve that same node:
$(this).find("action").text();
edit with more info: I used text/xml because I read that Firefox treat XML like that and IE with 'xml'.
also, this works:
$(document).ready(function() {
$.post("wired.xml", {}, function() {
alert("yeah!");
});
});
but this doesn't:
$(document).ready(function() {
$.post("wired.xml", {}, function() {
alert("yeah!");
}, 'xml');
});
and this work:
$(document).ready(function() {
$.post("wired.xml", {}, function() {
alert("yeah!");
}, 'text/xml');
});
but treats the xml as html.
Thank you.