Dear SiCo, I'm not sure what kind of error that you want to trigger. But for XHR, usually, it is the errors that may cause between browser and webserver. If it is what you want, please refer to http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
Below code is what I'm using. - It makes a call to PHP file and show response in <div id="response_output"></div> -->if success show response in green color -->if fail show response in red color --------------- sample code --------------- $.ajax({ type: "POST", url: "phpservice.php", data: "key=xxx&value=yyy", success: function(xhr){ $('#response_output').css({color: 'green'}).html = xhr.status +":"+xhr.responseText; // do some other stuff ... }, error: function(xhr){ $('#response_output').css({color: 'red'}).html = xhr.status +":"+xhr.responseText; } }); --------------- end of sample code --------------- On Apr 21, 2:17 pm, SiCo <[EMAIL PROTECTED]> wrote: > Thanks for the tips so far, I will try it later. The weird thing I've > just noticed is that the PHP runs fine and responds with the correct > messages (XML - Added ok - etc etc) but the ajax error function fires, > hence why I want to see the exact message. > > I will try try alerting xhr.responseText and see what I get. > > And I've read this: > "from the source: > (Function) error - A function to be called if the request fails. The > * function gets passed tree arguments: The XMLHttpRequest object, > a > * string describing the type of error that occurred and an > optional > * exception object, if one occured. " > > But this is what prompted the question, I don't find some of the docs > particularily helpful to newbies, unless you understand the JS behind > it in the first place which I am getting there with! > > Thanks > Simon