diff --git a/promiseTask.js b/promiseTask.js new file mode 100644 index 0000000..aa1cbe6 --- /dev/null +++ b/promiseTask.js @@ -0,0 +1,18 @@ +let addReq=(url)=> { + return new Promise((resolve, reject) => { + let xhr = new XMLHttpRequest() + xhr.open('GET', url, true); + xhr.onload = function () { + let json = JSON.parse(this.responseText); + // if(json.getUsersData){ + resolve(json); + + // } + } + xhr.send(); + }); +} + +addReq('http://www.json-generator.com/api/json/get/cfQCylRjuG') +.then(()=>{return addReq('http://www.json-generator.com/api/json/get/cfVGucaXPC')}) +.then(item => console.log(item));