Thanks, Jake, that was the problem exactly. My PHP script was sending
the XML string with a Content-Type of text/html. Once I changed it to
text/xml, jQuery was all sexy again.
m.
On Tue, 2006-10-03 at 14:06 -0700, Ⓙⓐⓚⓔ wrote:
> Since I can't see what your script is or how your server is serving
> it.. I'll share my experience
>
> when you get a pure xml file or a cgi created xml file with the
> correct headers the parameter 'xml' is actually a dom tree. If it is a
> "text/whateveelse" mimetype, you get text only! no dom!
>
> Down inside jquery I patched the ajax call to override mime type, for
> html requests, so I could easily get at the dom of my xhtml. After a
> while I decided it was just as easy to regex thru the text as it is to
> $('node',xml).
>
> so my advise is to check the typeof xml.
> Jake
>
> On 10/3/06, Matt Grimm <[EMAIL PROTECTED]> wrote:
> > I was under the impression that the following code should work, but I'm
> > having no luck at all. I have a PHP script that returns a simple XML
> > string and I need to get the value of the one and only element.
> >
> > $.get('/path/to/script', function(xml) {
> > // xml variable is '<?xml version="1.0"?><result>1</result>'
> >
> > // r variable is []
> > var r = $('result', xml);
> >
> > // t variable is ""
> > var t = r.text();
> > });
> >
> > I know that the "context" parameter of the $ function is supposed to be
> > a DOM object or document, but I thought a previous version of jQuery
> > allowed an XML string to be passed in as well. Does jQuery parse XML
> > strings into documents or how else is this functionality accomplished?
> >
> > m.
> >
> > _______________________________________________
> > jQuery mailing list
> > [email protected]
> > http://jquery.com/discuss/
> >
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/