【文件属性】:
文件名称:ajax-promise
文件大小:2KB
文件格式:ZIP
更新时间:2021-05-01 16:42:05
JavaScript
Ajax承诺
描述
一个范围非常狭窄的Ajax库,它返回promise而不是使用回调。
返回值应该是状态为200的JSON对象。
如果状态不是200,则Promise将返回错误。 该错误也应作为JSON对象返回。
用法
var AjaxPromise = require ( 'ajax-promise' ) ;
AjaxPromise
. get ( '/pages' )
. then ( function ( response ) {
console . log ( response ) ;
} )
AjaxPromise
. post ( '/pages' , { title : 'Hello' , body : 'Hello to the world!' } )
. then ( function ( response ) {
console
【文件预览】:
ajax-promise-master
----.gitignore(13B)
----README.md(697B)
----package.json(1KB)
----index.js(880B)