mcrawford-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Jan-16 18:43 UTC
Ajax Response responseXML is null in IE
This may be a Prototype question but is probably a general JavaScript question. I am creating an Ajax.Request and getting back a response that should be evaluated as XML. But in IE, in my onSuccess function, the response.responseXML object is null. In Firefox it works properly. I have checked the three things that are supposed to determine whether the browser interprets the response text as XML: the content-type is application/atom+xml, the ready state is 4, and if I open the requested URL in Internet Explorer, it shows the page just fine, with no errors, so the XML must be well-formed. But even with those three things true, the response text does not get evaluated as XML and stuck into the responseXML object in IE! I haven''t found anything about this situation on the web, other than the things I''ve already checked. Anyone have any ideas? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
mcrawford-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Jan-16 20:12 UTC
Re: Ajax Response responseXML is null in IE
I found that if I use this code in my onSuccess function, I can force it to work: updateOnSuccess : function(response) { if (Prototype.Browser.IE) { var d = new ActiveXObject("MSXML2.DOMDocument"); d.loadXML(response.responseText); response.responseXML = d; } ...code to use response.responseXML ... So I can force IE (I''m using IE7, forgot to say that originally) to parse the XML and store it as a document, so it''s gotta be valid XML. But the automatic processing that is supposed to happen with the response is not happening. I''d still like to understand why not, if anyone has any ideas. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
mcrawford-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Jan-16 21:53 UTC
Re: Ajax Response responseXML is null in IE
As far as I can tell, it turns out that IE7 doesn''t follow the specification for this part of the XMLHttpRequest object (which admittedly is only a working draft). Because I was able to get the whole thing to work if I receive a response with a content-type of text/xml. My original response had a content-type of application/atom +xml, which according to the spec, should get evaluated since it ends in +xml. But that doesn''t happen in IE7; it apparently requires the text/xml type for it to work. Frustrating. Sorry to clog the group with something I figured out myself, but maybe it will be useful to someone else. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---