Suppose, for example, that I want to partially clone the Gmail interface with jQuery Ajax and do periodic automatic saving as well as sending. And in particular, suppose that I care about error handling, expecting network and other errors, and instead of just being optimistic, I want to handle various errors intelligently.
If I use the "low level" function $ .ajax (), then it clears how to specify the error callback, but the convenient methods $ .get (), $ .post () and .load () do not allow the error callback to be specified.
What are the best methods for pessimistic error handling? Is this by registering .ajaxError () with specific wrapped sets or a global introspection-style error handler in $ .ajaxSetup ()? How do the corresponding parts of the code look like to initiate autosave, so that a warning such as "autosave failed" is displayed if the autosave attempt failed and possibly a message configured to the error type?
Thanks,
javascript jquery ajax
Jonathan hayward
source share