【文件属性】:
文件名称:xhr:matthewpxhr,正如承诺的那样
文件大小:4KB
文件格式:ZIP
更新时间:2021-06-25 13:49:29
JavaScript
xhr
用于 HTTP 请求的最小模块。 返回一个promise 。
安装
$ npm install nathan7/xhr
或者
$ component install nathan7/xhr
应用程序接口
xhr(网址,选项)
使用给定的选项对给定的 URL 执行 GET 请求。
选项
options对象具有以下属性:
网址
执行请求的 URL。
方法
要使用的 HTTP 方法(GET、POST、PUT、DELETE 等)。 默认为GET 。
标题
包含标题的对象。
headers: {
'Accept' : 'application/json'
}
数据
作为请求正文发送的数据。
证书
仅限浏览器。 如果为 true,则withCredentials值将应用于 XMLHttpRequest 对象,该对象允许请求。
例子
var xhr = require ( 'xh
【文件预览】:
xhr-master
----core.js(1KB)
----.jshintrc(74B)
----README.md(1KB)
----component.json(271B)
----.gitignore(44B)
----index.js(234B)
----core-browser.js(1KB)
----package.json(525B)