Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A standalone lightweight JSONP JavaScript library

branch: master

Partially merged pull requests

Added the possibility to set an error-handler through init. See
example/example.html
latest commit 2dbd3afa9f
Erik Karlsson authored November 25, 2012
Octocat-spinner-32 example Partially merged pull requests November 25, 2012
Octocat-spinner-32 README Update README April 10, 2012
Octocat-spinner-32 jsonp.js Partially merged pull requests November 25, 2012
README
Lightweight JSONP Javascript Library without dependencies.

Usage:

/* Optional setting for default callback name */
JSONP.init({
  callbackName: 'jsonp'
});


/* 
* This will make a request for the url 
* /test?otherParam1&param1=a&param2=b&callback=json{N}  where {N} is an auto incrementing counter
* and then callback your function with the response.
* Fourth parameter is if you want to override the "callback" named parameter. 
*/
JSONP.get('/test?otherParam=1', {param1:'a', param2:'b'}, function(response){
	console.log(response);
}/* , "overrideCallbackName" */);
Something went wrong with that request. Please try again.