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

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

  2. 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

Leave a Reply

Your email address will not be published. Required fields are marked *