Skip to content

Instantly share code, notes, and snippets.

@jphenow
Created October 12, 2015 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jphenow/2b884f8c3643e6c8dc40 to your computer and use it in GitHub Desktop.
Save jphenow/2b884f8c3643e6c8dc40 to your computer and use it in GitHub Desktop.
Wait for callback to loop
var queue = [] // build up what you'd be looping through
function callAjax(el) {
$.ajax(things, {
complete: function() {
callAjax(queue.shift)
}
})
}
callAjax(queue.shift)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment