Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
285
How to deal with server-side errors in an ajax request?
posted

I'm fairly new using the jQuery controls, so maybe this is obvious, but I'm hoping someone can point me in the right direction.  I have a simple grid that uses the DataSourceURL to asynchronously get data from the server and populate the grid.  Most of the time, it works well.  But I'm trying to find the right way to adapt when something goes wrong on the server-side during the ajax call.  

Maybe the database timed out, maybe it's completely down, maybe the user doesn't have permission to view this data, maybe there's some other unexpected exception while trying to retrieve the data.  It's easy enough to log the error and return no records.  But, how do I tell the user what's going on?  Especially for cases that aren't really an error, like users not having permission - I want to pass on an appropriate message.

By the way, I tried using the example here, but it looks like that won't work because it's not a js error, so ajaxSetup.Error and ajaxComplete never fire.  

If it matters, I'm using Asp.Net MVC 4 with C#, Infragistics IgniteUI 13.1

Thanks for any suggestions you can give.  

- Brad.

Parents Reply Children
No Data