0.2.0 • Published 5 years ago
flex-jsonp v0.2.0
flex-jsonp
Support Promise For JSONP.
demo
install
npm install flex-jsonp --save
chain usage
flexJsonp({
url: 'http://suggestion.baidu.com/su',
params: {
wd: keywords,
p: 3,
t: new Date().getTime()
},
callbackParam: 'cb'
}).then(function (res) {
console.log(res);
}).catch(function (err) {
console.log(err);
});
parameters
names | type | default | explain |
---|---|---|---|
url | string | '' | The url requested by JSONP |
params | object | {} | Request parameters |
timeout | number | 0 | Request timeout setting |
callbackParam | string | 'cb' | JSONP callback function parameter name |
callback | string | 'callback'+${seed} | JSONP callback function name |
License
MIT