I'm using jqGrid to display the results of a database query. The php script which performs the query and then formats the results as XML for consumption by jqGrid also does some error-checking. (For example, it might validate dates to be sure that they're in the correct format and that the start date is before the end date.) These kinds of errors are formatted into XML, but in a different format than a successful query.
What I want to do is to intercept the result of the ajax call and process it differently depending on whether the result contains one of these custom errors. If no error is present, then I would want to load the result in jqGrid. If there is an error, I would just display on the page without the grid (since the grid is set up for a different number of columns).
What I'm looking for is the correct approach of how to proceed (not necessarily the actual code). (My issue is not how to parse the XML response, but how to intercept it so I am able to parse it.) I had hoped to use the jqGrid events like gridComplete or loadComplete, but these seem to fire after the grid is already loaded.