Skip to content

max-mapper/jsonpify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSONP-ifier!!!!!

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:

 $.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!

  $.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                                                                        
    }                                                                                           
  });

Installation

Clone this repository, then run:

$ rackup

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

About

turn json apis into jsonp apis through a heroku proxy!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages