AJAX with OK status but still throwing error
Just a quick note to say AJAX can be tricky and difficult to debug on occasion. When receiving an OK response from an AJAX request you would not expect an unsuccessful result. This happens when using jQuery and a dataType for the response being XML and not setting the headers correctly to specify that you are returning XML. If it is just interpreted as plain text you get the error from jQuery because the response is not an XML document. Do do this, set your headers to:
header(“Content-type: text/xml”);
This is the PHP script to set the content type to XML. Make sure this is set before any outputting to the browser. This includes “print” and “echo”. This should be one of the first things your do.
