Skip to content
sobstelPublic

About

Lightweight JSONP library for cross-domain ajax calls.

Resources

Stars

36 stars

Watchers

5 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

jsonp.js

JSONP cross-domain ajax calls written in pure Javascript.

Usage

If using an AMD loader, you need to set up the path config in e.g. require.js so that 'jsonp' resolves to the module's path

require('jsonp', function(jsonp) {

  jsonp.send('url?callback=handleStuff', {
    callbackName: 'handleStuff',
    onSuccess: function(json){
      console.log('success!', json);
    },
    onTimeout: function(){
      console.log('timeout!');
    },
    timeout: 5
  });

});

Notes

You need to add callback name to URL yourself if you need it, eg.

jsonp.send('url?callback=name', {
  callbackName: 'name'
});

About

Lightweight JSONP library for cross-domain ajax calls.

Resources

Stars

36 stars

Watchers

5 watching

Forks

Releases

Packages

Contributors

Languages