Simple script to manage JSONP calls

Usage no npm install needed!

<script type="module">
  import jabiru from 'https://cdn.skypack.dev/jabiru';



Build Status

Simple script to manage JSONP calls.


Add the distribution file to your project.

<script src="/scripts/jabiru.min.js"></script>

You can also install it as a node module.

npm install jabiru --save

Using bower to install packages in your project?

bower install jabiru --save


If you need to do a cross domain call jaribu will help you. You just need to call its get() method with the url and the function you need to manage the response in a configuration object.

    url: 'http://api.github.com/users/jeremenichelli',
    success: function(response) {
        // do something with the response


Now in v2.0.0 you can also control failure cases adding an optional fail method.

    url: 'http://api.github.com/users/jeremenichelli',
    success: function(response) {
    fail: function() {

Query string

APIs have different query structure, for example Github's one uses ?callback to name its jsonp method but if the api you're trying to reach needs another syntax you can use the query method to change it.


Callback dynamic name

Every time a request is done through jabiru a temporary function is created, by default that method name is jabiruCallback, but you can modify that using the naming function.


Every time you change the name of the method the internal call counter will be set to 0 again. Also this name will be contained in the module namespace for security, in this example jabiru.myMethod0 for the first call.

If you want it to be globally available you can call jabiru.toGlobal() before starting to use the script, but window.MyMethod0 will be available for any script while the call is being made.

Once you call jabiru.toGlobal() you can't revert to the namespace state.


You can stick all this configuration together like this:

        url: 'https://api.github.com/users/jeremenichelli',
        success: function(response) {

Remember you don't have to set the name and the query string every time. For the rest of the calls you just have to use the get method.

Browser support and size

The last version of jabiru weighs only 503 bytes minified and gzipped and it works in Chrome, Firefox, Safari, Microsoft Edge, Internet Explorer 9, 10, and 11. From version 2.0.0 the support for Internet Explorer 8 was dropped.

If you want this library to work in Internet Explorer 8 you can use v1.1.0.


If you find a bug or something that should be added as a feature let me know here.