When creating an Ajax.Request(''/path.xml'') i don''t get responseXML. I''m confused what I am doing wrong. If i change the response variable and dump responseText, it shows the file, it just doesn''t recognize it as xml. function xml(url){ new Ajax.Request(url, { method: ''post'', parameters:''resultSet=simcall'', onSuccess:parseResponse, onFailure:function(xhrResponse){alert(''nope'');} }); } var parseResponse= function(xhrResponse){ var response=xhrResponse.responseXML; var paramList= response.getElementByTagName(''lastname''); alert(paramList[0].firstChild.nodeValue); } <?xml version="1.0" encoding="iso-8859-1"?> <employees> <employee id="123456"> <lastname>Smith</lastname> <firstname>Edward</firstname> <phone>(415) 333-0235 </phone> <username>esmith</username> </employee> </employees> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks. Appreciate the help. DJ On 3/24/08, dizzyjay <dizzyjay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > When creating an Ajax.Request(''/path.xml'') i don''t get responseXML. > I''m confused what I am doing wrong. If i change the response variable > and dump responseText, it shows the file, it just doesn''t recognize it > as xml. > > function xml(url){ > new Ajax.Request(url, { > method: ''post'', parameters:''resultSet=simcall'', > onSuccess:parseResponse, > onFailure:function(xhrResponse){alert(''nope'');} > }); > } > var parseResponse= function(xhrResponse){ > var response=xhrResponse.responseXML; > var paramList= response.getElementByTagName(''lastname''); > alert(paramList[0].firstChild.nodeValue); > } > > > <?xml version="1.0" encoding="iso-8859-1"?> > <employees> > > <employee id="123456"> > <lastname>Smith</lastname> > <firstname>Edward</firstname> > <phone>(415) 333-0235 </phone> > > <username>esmith</username> > </employee> > </employees> >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
If your httpd handling XML files right? Try to access the file using firefox or other browser directly and see if it shows up as XML. If not your might have a problem with your server Content-type headers. Cheers On Mar 25, 8:27 am, dizzyjay <dizzy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> When creating an Ajax.Request(''/path.xml'') i don''t get responseXML. > I''m confused what I am doing wrong. If i change the response variable > and dump responseText, it shows the file, it just doesn''t recognize it > as xml. > > function xml(url){ > new Ajax.Request(url, { > method: ''post'', parameters:''resultSet=simcall'', > onSuccess:parseResponse, > onFailure:function(xhrResponse){alert(''nope'');} > });} > > var parseResponse= function(xhrResponse){ > var response=xhrResponse.responseXML; > var paramList= response.getElementByTagName(''lastname''); > alert(paramList[0].firstChild.nodeValue); > > } > > <?xml version="1.0" encoding="iso-8859-1"?> > <employees> > > <employee id="123456"> > <lastname>Smith</lastname> > <firstname>Edward</firstname> > <phone>(415) 333-0235 </phone> > > <username>esmith</username> > </employee> > </employees>--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---