Last active
February 23, 2018 18:49
-
-
Save cryocaustik/3b31ce918cdcceb3382caf24cf81b315 to your computer and use it in GitHub Desktop.
example of async ajax request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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