Reputation: 2660
Sometimes when the user triggers the same event more than once, the same Ajax call is made multiple times. Its pretty straight forward to setup a simple object to keep track of identical calls and abort the oldest ones, but how can I deal with this when there are chains of calls made?
What do I mean with chains: Lets say user clicks a button and that triggers ajax_A(...). At some later point ajax_B(...) is also executed. At this point the user clicks the same button again which invokes the same chain again.
Is there a practical way of aborting the whole chain (both ajax_A(...) and ajax_B(...))?
Our current solution is quite obtrusive for those sections where we make an ajax call that is part of a chain.
Upvotes: 0
Views: 133
Reputation: 6159
You might want to have a look at the new jQuery 1.5 deferreds: http://www.erichynds.com/jquery/using-deferreds-in-jquery/
Upvotes: 1