Skip to content

Instantly share code, notes, and snippets.

@sshine
Created January 20, 2015 01:24
Show Gist options
  • Save sshine/fe5ddf9c3763583e0c10 to your computer and use it in GitHub Desktop.
Save sshine/fe5ddf9c3763583e0c10 to your computer and use it in GitHub Desktop.
I miss monads...
$.ajax({ url: "foo.csv", dataType: "text" })
.done(function(data) {
fetchPostTags(data);
$.ajax({ url: "bar.csv", dataType: "text" })
.done(fetchPostsComments);
.fail(function(failure) {
updateStatus("Failed to load posts-comments.csv");
console.log(failure);
});
})
.fail(function(failure) {
updateStatus("Failed to load posts-tags.csv");
console.log(failure);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment