1.2.0 • Published 8 years ago

b-jsonp v1.2.0

Weekly downloads
235
License
MIT
Repository
github
Last release
8 years ago

b-jsonp

npm Build Status Code Climate

A simple, efficient, and small jsonp library for the browser.

Install

With NPM:

npm install b-jsonp --save

Manual Install:

<script src="/path/to/b-jsonp.min.js"></script>

Usage

All data passed to b-jsonp will automatically be URL encoded. b-jsonp is also aware if a URL currently contains a ? and will adjust the request URL accordingly.

Simple request
jsonp('http://your/url', function(err, response) {
  // your code here
});
Passing data
jsonp('http://your/url', { foo: 'bar' }, function(err, response) {
  // your code here
});
Additional options
jsonp('http://your/url', { foo: 'bar' }, { name: 'cb' }, function(err, response) {
  // your code here
});

// OR WITH NO DATA
//
jsonp('http://your/url', null, { name: 'cb' }, function(err, response) {
  // your code here
});

Available options

OptionTypeDefaultDescription
nameStringnullName of function to be called by the jsonp callback. By default one is generated for you.
paramString'callback'Name of callback parameter in URL
prefixString'__jsonp'Prefix used when a callback name is generated automatically
timeoutNumber15000Time to wait in milliseconds until the jsonp request is canceled

License

MIT

1.2.0

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago