0
我正在开发没有任何框架的简单应用程序。如何从简单的ES6应用程序进行Http操作
我该如何做简单的Http请求(get/post)?
我了解的XMLHttpRequest():
var xhr = new XMLHttpRequest();
xhr.open('GET', 'phones.json', false);
xhr.send();
if (xhr.status != 200) {
alert(xhr.status + ': ' + xhr.statusText);
} else {
alert(xhr.responseText);
}
但也许有另一种方式?
- 请不要任何图书馆。