Hi,
I'm fetching a url using $.get():
$.get(url, function(xml) {
alert($(tag, xml).get(0).text);
});
xml is a simple xml tag:
tagbody/tag
IE works fine and alerts body, but FF alerts undefined.
___
jQuery mailing list
discuss@jquery.com
may add a prolog to xml file will help:?xml version=1.0 encoding=UTF-8 ?2006/8/9, Mohsen Saboorian
[EMAIL PROTECTED]:Hi,I'm fetching a url using $.get():$.get(url, function(xml) {
alert($(tag, xml).get(0).text);});xml is a simple xml tag:tagbody/tagIE works fine and alerts body, but FF alerts
Thank you Klaus.
Yes, my MIME was set text/xml.
1. alert($(tag, xml).get(0).text);
2. alert($(tag, xml).text());
IE: 1, 2 works
FF: only 2 works
just putting a prolog on top will not make it xml. please check if you
have set the correct mime type for your ajax response.
with the extremely
Also this works fine for both IE and FF:
alert($(tag, xml).get(0).firstChild.data);
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
Also this works fine for both IE and FF:
alert($(tag, xml).get(0).firstChild.data);
When accessing the text value of XML elements you should always use
.nodeValue - that works the most reliably from browser to browser.
This is why doing the jQuery .text() works in both browsers.
--John