Light and robust JSONP library.
$ npm install --save promisify-jsonp
pjsonp(url, options);
name | type | required | default value | description |
---|---|---|---|---|
callbackName | String | false | - | name of jsonp callback function |
callbackNamePrefix | String | false | __jp | prefix for callbackName |
callbackParamName | String | false | callback | parameter name of callbackName in query string |
timeout | Number | false | 0 | request timeout(0 means no timeout) |
params | Object | false | {} | extend parameter to query string |
encode | Boolean | false | true | encode parameter in query string |
var pjsonp = require("pjsonp");
pjsonp("https://www.example.com/jsonp")
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});