All Projects → maxogden → Jsonpify

maxogden / Jsonpify

turn json apis into jsonp apis through a heroku proxy!

Programming Languages

ruby
36898 projects - #4 most used programming language

h1. JSONP-ifier!!!!!

h2. Turns any JSON API into a JSONP API through the magic of proxying

So you are trying to AJAX some JSON, right? And you run into the single origin policy? And the JSON API that you're hitting hasn't implemented JSONP? Dang! Here's an example of what you might do:

bc. $.getJSON("http://api.plancast.com/02/plans/show.json?plan_id=34ck", function(data) { doStuffWith(data)});

But instead of precious data, you would receive nasty CSRF error!

Fret not, young internet warrior! You can wrap that little puppy in a JSONPify URL for maximum JSONPification!

bc. $.ajax({
url: "http://jsonpify.heroku.com?resource=http://api.plancast.com/02/plans/show.json",
data: { plan_id: '34ck' } dataType: 'jsonp',
success: function(data){
// manipulate data
}
});

h2. Installation

Clone this repository, then run:

bc. $ rackup

Then, open http://localhost:9292/.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].