I have a jqgrid that\'s functionning very well.
I was wondering is it possible to catch server sent errors ? how Is it done ?
From what I see, it returns the data as a json string. So what you have to do is add an error handler that formats the error as a json string and prints it out as one. This can be done in php with the
set_error_handler
function.
The error handler would then I guess push the data in to jsonReturn.error, so you would just need to check for that when you are adding your data to the table.
If you are throwing exceptions instead of letting it get all the way to errors (probably a better practice), then you would want to format the exception as a json string.
Since it is returning the data in an xml format, you would want to parse the xml:
error message
like this:
$(request.responseXML).find("error").each(function() {
var error = $(this);
//do something with the error
});
Shamelessly borrowed from: http://marcgrabanski.com/article/jquery-makes-parsing-xml-easy