I haven’t blogged here for some time (something I intend to correct this year!) but have written a few detailed articles for the Pluralsight blog the last few months that may be of interest:
I wanted to write a little wrapper for jQuery’s Ajax function that would retry a request in the event of a transient failure. This could be quite a common scenario for a mobile optimized website where a users mobile device moves out of signal area briefly. I also wanted to add the ability to increase the time between request attempts with a backoff function so as not to waste requests.
I played around a bit with proxying jQuery’s core Ajax function in the sameway jquery-mockajax does. I also discovered some other interesting options using jQuery prefilters which I wasnt aware of existed but will certainly be taking a deeper look into.
Anyway I settled on adding another method called ajaxWithRetries.
It’s my first stab at this on a lazy sunday arvo so its likely to be quite buggy (current retry count is not specific to an individual function for example) & I havent tested it on various browsers so use at your own risk 🙂
Its up on github at https://github.com/alexmackey/retryajax