Skip to content

Instantly share code, notes, and snippets.

@kevincianfarini
Last active August 4, 2019 23:29
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 kevincianfarini/0899a34b614a457cb4169ea6cb251915 to your computer and use it in GitHub Desktop.
Save kevincianfarini/0899a34b614a457cb4169ea6cb251915 to your computer and use it in GitHub Desktop.
function getData() {
$.ajax({
url: "blah.html",
success: function(data) {
var data1 = data;
$.ajax({
url: "blah2.html",
success: function(data) {
console.log("callback hell");
},
error: function(data) {
...
}
});
},
error: function(data) {
// retry
$.ajax({
url: "blah.html",
success: function(data) {
// do something
},
error: function(data) {
...
}
});
}
});
return data1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment