yeah I see how that works... but it's not best to use async:false,
unless you really want it sync.
with the 'complete' callback you get a parm that has the whole req.
and can get the responseText from it.
also... your var is not xml it's text, and the dataType should not be
set to "xml" for non-xml requests... it doesn't kill you.. it's just
misleading.
ajah(or ajat) is what you're doing, it's akin to ajax but without any
xml involved.
I learned about the different callbacks from the docs... and now it's
committed to memory!
On 2/13/07, Stephen Woodbridge <[EMAIL PROTECTED]> wrote:
> Jake,
>
> Thanks for the help. I changed my code to look like this and got things
> to work.
>
> $('#rgeo').bind('submit', function(){
> var xml = $.ajax({
> url: "/rgeo/",
> dataType: "xml",
> async: false,
> data: {
> x: document.rgeo.x.value,
> y: document.rgeo.y.value
> }
> }).responseText;
> $("#response")[0].value = xml;
> return false;
> });
>
> This should be better documented in the $.ajax() documentation.
>
> Thanks,
> -Steve
>
> Ⓙⓐⓚⓔ wrote:
> > you're close... you don't get simple text from an xml request.
> >
> > you get a big ol' request object.
> >
> > if you just want the text from the html
> >
> > you can see it in a 'complete' call back with data.responseText
> >
> > inside success, you get back the responseXML part of the request.
> > it's an xmlDocument that needs to be navigated with $("answer",data)
> > or something like that!
> >
> > Hope that helps!
> >
> >
> > On 2/13/07, Stephen Woodbridge <[EMAIL PROTECTED]> wrote:
> >> Hi all,
> >>
> >> How do I get the XML response of an ajax request? I want to put the XML
> >> text into a textarea and can do find this documented.
> >>
> >> $.get("/rgeo/",
> >> { x: document.rgeo.x.value, y: document.rgeo.y.value },
> >> function(data){
> >> console.log(data);
> >> $("textarea#response")[0].value = data;
> >> }
> >> );
> >>
> >>
> >>
> >> My textarea ends up with the string "[object XMLDocument]"
> >>
> >> I also tried:
> >>
> >>
> >> $.ajax({
> >> url: "/rgeo/",
> >> dataType: "xml",
> >> data: {
> >> x: document.rgeo.x.value,
> >> y: document.rgeo.y.value
> >> },
> >> success: function(data){
> >> console.log(data);
> >> $("textarea#response")[0].value = data;
> >> }
> >> });
> >>
> >> Thanks,
> >> -Steve
> >>
> >> _______________________________________________
> >> 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/