As an open-source project, camsong/fetch-jsonp has picked up 1.0k stars on GitHub (JavaScript). Make JSONP request like window.fetch
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
JSONP is NOT supported in standard Fetch API, https://fetch.spec.whatwg.org.
fetch-jsonp provides you same API to fetch JSONP like native Fetch, also comes
with global fetchJsonp function.
If you need a fetch polyfill for old browsers, try github/fetch.
Installation
You can install with npm.
npm install fetch-jsonp
Promise Polyfill for IE
IE8/9/10/11 does not support ES6 Promise, run this to polyfill the global environment at the beginning of your application.
require('es6-promise').polyfill();
Usage
JSONP only supports GET method, same as fetch-jsonp.
Difference between jsonpCallback and jsonpCallbackFunction
There two functions can easily be confused with each other, but there is a clear distinction.
Default values are
jsonpCallback, default value is callback. It's the name of the callback parameter
jsonpCallbackFunction, default value is null. It's the name of the callback function. In order to make it distinct, it's a random string with jsonp_ prefix like jsonp_1497658186785_39551. Leave it blank if it's set by the server, set it explicitly if the callback function name is fixed.
1. You need to call .then(function(response) { return response.json(); }) in order to keep consistent with Fetch API.
2. Uncaught SyntaxError: Unexpected token : error
More than likely, you are calling a JSON api, which does not support JSONP. The difference is that JSON api responds with an object like {"data": 123} and will throw the error above when being executed as a function. On the other hand, JSONP will respond with a function wrapped object like jsonp_123132({data: 123}).
Browser Support
Latest ✔
Latest ✔
8+ ✔
Latest ✔
6.1+ ✔
License
MIT
Acknowledgement
Thanks to github/fetch for bring Fetch to old browsers.
No homepage URL was recorded for camsong/fetch-jsonp in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
Is camsong/fetch-jsonp open source?
TopGit's metadata for camsong/fetch-jsonp does not record a license. Most public repositories on GitHub ARE open source, but the exact terms vary — verify by opening the LICENSE file directly.
What is camsong/fetch-jsonp?
camsong/fetch-jsonp (camsong/fetch-jsonp) is a JavaScript project on GitHub. From the project's own README: Make JSONP request like window.fetch
Where do I read more about camsong/fetch-jsonp?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/camsong/fetch-jsonp is the definitive source.
Read full README in the tab above.
Still deciding about fetch-jsonp?
One click hands the question to an AI along with this page — see what it says about fetch-jsonp.