ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: gerdriese on April 26, 2016, 06:08:38 pm
-
Is there any possibility for checking if there was an error during an ajax request (as saving or updating to the server) and showing an error message (message received from the server)? what does the server side has to do? Status Code 500? Json reply? Are there any examples for error handling?
Thanks
-
Broadly there are 2 type of errors:
1) Unexpected or uncatched errors like 404 or 500 server errors.
dataModel.error callback can be implentend to handle or troubleshoot these kind of errors:
http://paramquery.com/pro/api#option-dataModel-error
If direct Ajax calls are made with jQuery, then $.ajax( { error: function(){} } can be used to handle/ troubleshoot the errors.
http://api.jquery.com/jquery.ajax/
2) catched errors whereby more user friendly messages are returned by the server.
In this case, dataModel.getData( response ) callback can be used to handle/display the error response to user depending upon the format of the error message.
and success callback can be used in case of direct call through jQuery ajax method.
-
Ok, thanks - I'll take a look at the two options! Thanks.