Skip to content

Instantly share code, notes, and snippets.

@BriceShatzer
Created March 3, 2014 19:06
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 BriceShatzer/9332279 to your computer and use it in GitHub Desktop.
Save BriceShatzer/9332279 to your computer and use it in GitHub Desktop.
ajax flow
//----- 1 -----
$.ajax({
url: '/path/to/file',
success: function(data){
//do something;
//do more stuff to with the something that was just done.
},
dataType: 'html'
});
//----------
//----- 2 -----
$.ajax({
url: '/path/to/file',
success: function(data){
//do something;
},
dataType: 'html'
}).done(function() {
//more stuff to with the something that was just done.
});
//----------
//----- 3 -----
$.when(
$.ajax({
url: '/path/to/file',
success: function(data){
//do something;
},
dataType: 'html'
})
).done(function() {
//do more stuff to with the something that was just done.
})
//----------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment