Hi, I want to load an XHTML file into DOM. I issue Ajax.Request and on success do: var response=transport.responseXML Response is null. On the other hand: var response=transport.responseText; // has the data. Why is response=transport.responseXML returns null? Here is the code: function display() { url = "http://" + location.hostname + port + "/fusion/ restlet/"; url = url + "engines" + sServer; new Ajax.Request(url, { method:"get", contentType:"application/xhtml+xml", onSuccess: function(transport) { var response = transport.responseXML; // null ? //var response = transport.responseText; // OK alert("after response=" + response); if (response != null) { alert("b=" + response.getElementById(''lastUpdate'').innerHTML); // this never works } else alert("onSuccess, responseXML is null"); }, onFailure: function(){ alert("Cannot get data from server: " + location.host) } }); } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You have to set a correct content-type (application/xml). Regards, Tobie On Sep 28, 12:39 am, AlexK <alexkoif...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I want to load an XHTML file into DOM. I issue Ajax.Request and on > success do: > var response=transport.responseXML > > Response is null. On the other hand: > var response=transport.responseText; // has the data. > > Why is response=transport.responseXML returns null? > > Here is the code: > > function display() { > url = "http://" + location.hostname + port + "/fusion/ > restlet/"; > url = url + "engines" + sServer; > new Ajax.Request(url, > { > method:"get", > contentType:"application/xhtml+xml", > onSuccess: function(transport) { > > var response = transport.responseXML; // null ? > //var response = transport.responseText; // OK > > alert("after response=" + response); > if (response != null) { > alert("b=" + > response.getElementById(''lastUpdate'').innerHTML); // this never works > } > else > alert("onSuccess, responseXML is null"); > }, > onFailure: function(){ alert("Cannot get data from server: > " + location.host) } > }); > }--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi, this: contentType: "application/xml" did not change anything. ANy other ideas? Thanks. On Sep 27, 7:16 pm, Tobie Langel <tobie.lan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You have to set a correct content-type (application/xml). > > Regards, > > Tobie > > On Sep 28, 12:39 am, AlexK <alexkoif...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi, > > > I want to load an XHTML file into DOM. I issue Ajax.Request and on > > success do: > > var response=transport.responseXML > > > Response is null. On the other hand: > > var response=transport.responseText; // has the data. > > > Why is response=transport.responseXML returns null? > > > Here is the code: > > > function display() { > > url = "http://" + location.hostname + port + "/fusion/ > > restlet/"; > > url = url + "engines" + sServer; > > new Ajax.Request(url, > > { > > method:"get", > > contentType:"application/xhtml+xml", > > onSuccess: function(transport) { > > > var response = transport.responseXML; // null ? > > //var response = transport.responseText; // OK > > > alert("after response=" + response); > > if (response != null) { > > alert("b=" + > > response.getElementById(''lastUpdate'').innerHTML); // this never works > > } > > else > > alert("onSuccess, responseXML is null"); > > }, > > onFailure: function(){ alert("Cannot get data from server: > > " + location.host) } > > }); > > }- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
This is what I added to the XHTML file that I get: <meta http-equiv="Content-Type" content="text/xml; charset=UTF-8" /> and this: new Ajax.Request(url, { method:"get", contentType:"text/xml", onSuccess: function(transport) { And I still get null: var response transport.responseXML; Thanks! On Sep 28, 12:25 am, AlexK <alexkoif...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, this: > contentType: "application/xml" > > did not change anything. ANy other ideas? Thanks. > > On Sep 27, 7:16 pm, Tobie Langel <tobie.lan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > You have to set a correct content-type (application/xml). > > > Regards, > > > Tobie > > > On Sep 28, 12:39 am, AlexK <alexkoif...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi, > > > > I want to load an XHTML file into DOM. I issue Ajax.Request and on > > > success do: > > > var response=transport.responseXML > > > > Response is null. On the other hand: > > > var response=transport.responseText; // has the data. > > > > Why is response=transport.responseXML returns null? > > > > Here is the code: > > > > function display() { > > > url = "http://" + location.hostname + port + "/fusion/ > > > restlet/"; > > > url = url + "engines" + sServer; > > > new Ajax.Request(url, > > > { > > > method:"get", > > > contentType:"application/xhtml+xml", > > > onSuccess: function(transport) { > > > > var response = transport.responseXML; // null ? > > > //var response = transport.responseText; // OK > > > > alert("after response=" + response); > > > if (response != null) { > > > alert("b=" + > > > response.getElementById(''lastUpdate'').innerHTML); // this never works > > > } > > > else > > > alert("onSuccess, responseXML is null"); > > > }, > > > onFailure: function(){ alert("Cannot get data from server: > > > " + location.host) } > > > }); > > > }- Hide quoted text - > > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I use the following code in PHP to make sure my output is interpreted as XML header("Content-Type: text/xml"); and this code for ColdFusion. <cfheader charset="utf-8" name="Content-type" value="text/xml"> Cheers, Matt On Sep 28, 1:48 am, AlexK <alexkoif...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> This is what I added to the XHTML file that I get: > > <meta http-equiv="Content-Type" content="text/xml; charset=UTF-8" /> > > and this: > > new Ajax.Request(url, > { > method:"get", > contentType:"text/xml", > onSuccess: function(transport) { > > And I still get null: var response > transport.responseXML; > > Thanks! > On Sep 28, 12:25 am, AlexK <alexkoif...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi, this: > > contentType: "application/xml" > > > did not change anything. ANy other ideas? Thanks. > > > On Sep 27, 7:16 pm, Tobie Langel <tobie.lan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > You have to set a correct content-type (application/xml). > > > > Regards, > > > > Tobie > > > > On Sep 28, 12:39 am, AlexK <alexkoif...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi, > > > > > I want to load an XHTML file into DOM. I issue Ajax.Request and on > > > > success do: > > > > var response=transport.responseXML > > > > > Response is null. On the other hand: > > > > var response=transport.responseText; // has the data. > > > > > Why is response=transport.responseXML returns null? > > > > > Here is the code: > > > > > function display() { > > > > url = "http://" + location.hostname + port + "/fusion/ > > > > restlet/"; > > > > url = url + "engines" + sServer; > > > > new Ajax.Request(url, > > > > { > > > > method:"get", > > > > contentType:"application/xhtml+xml", > > > > onSuccess: function(transport) { > > > > > var response = transport.responseXML; // null ? > > > > //var response = transport.responseText; // OK > > > > > alert("after response=" + response); > > > > if (response != null) { > > > > alert("b=" + > > > > response.getElementById(''lastUpdate'').innerHTML); // this never works > > > > } > > > > else > > > > alert("onSuccess, responseXML is null"); > > > > }, > > > > onFailure: function(){ alert("Cannot get data from server: > > > > " + location.host) } > > > > }); > > > > }- Hide quoted text - > > > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---