Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getJson() {
- return new Promise(function(resolve, reject) {
- xhr.open("GET", "http://name.ru/res.json", true);
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4)
- resolve(rxhr.responseText)
- }
- xhr.send();
- }
- }
- getJson().then(function(response) {
- console.log(response)
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement