Home

Awesome

then-jsonp

Easy jsonp client for browser and node.js

Build Status Dependency Status NPM version

Sauce Test Status

Installation

npm install then-jsonp

Usage

var request = require('then-jsonp');

// with promises
var result = request('GET', 'http://example.com/foo/bar');
result.done(function (res) {
  console.dir(res);
});

// with callbacks
request('GET', 'http://example.com/foo/bar', function (err, res) {
  if (err) throw err;
  console.dir(res);
});

Method:

If this is anything other than 'GET' it gets added to the querystring as method=METHOD. The actual request is always a GET request. In the browser it's added as a <script> tag, on the server it uses then-request then evalutates the result in a vm.

URL:

The url to request.

Options:

License

MIT