如何对本地XHR进行编程?
Uncaught TypeError: Promise resolver undefined is not a function
)
function makeXHRRequest (method, url, done) { var xhr = new XMLHttpRequest(); xhr.open(method, url); xhr.onload = function() { return new Promise().resolve(); }; xhr.onerror = function() { return new Promise().reject(); }; xhr.send();}makeXHRRequest('GET', 'http://example.com').then(function (datums) { console.log(datums);});
相关分类