James RevilliniSay ‘no’ to styrofoam.

‘no element found’ in firebug or firefox javascript console (part 2)

I was right. If the server sends a response and the ‘Content-Type’ attribute is ‘text/xml’, you must send at least a root node so the xml parser that is built into Mozilla’s XMLHTTPRequest object doesn’t cak and give you a ‘no element found’ Javascript error.

This could be an issue for those of us who are trying to do the REST thing and send back proper status codes depending on the request method and actions taken by the server. A 204 (Updated) or 205 (Deleted) response cannot, by definition, have any content body, so sending a root node is not an option to get around this error. The server needs to determine if the response is going to have an xml content body and assign the Content-Type on the fly.

4 Responses to “‘no element found’ in firebug or firefox javascript console (part 2)”

Nim said:

Thanks for the info!. This “element not found” error was driving me crazy.
Greetings from spain

Jul 9th, 2009 at 3:11 am

Naveen said:

i got a same error wen i try to download and use Spellcheck.com code can u explain me in detail how can i get rid of those things

Aug 24th, 2009 at 6:02 am

John Blackmore said:

Thnak you for the info I have not been able to send correct status codes in some instances. This has given me an idea to fix :)

Nov 6th, 2009 at 1:47 am

Adrian said:

Thanks!

Mar 14th, 2010 at 3:32 am

Leave a Reply