Skip to content

Instantly share code, notes, and snippets.

@cryocaustik
Last active February 23, 2018 18:49
Show Gist options
  • Save cryocaustik/3b31ce918cdcceb3382caf24cf81b315 to your computer and use it in GitHub Desktop.
Save cryocaustik/3b31ce918cdcceb3382caf24cf81b315 to your computer and use it in GitHub Desktop.
example of async ajax request
function asyncRequest() {
var url = 'https://api.github.com/users/narenaryan';
return new Promise(function (resolve, reject) {
$.ajax({
url: url,
type: "GET"
})
.done(function(data){
resolve(data);
})
.error(function(err){
reject(err);
})
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment