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:https://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:https://jsonpify.heroku.com?resource=http:https://api.plancast.com/02/plans/show.json",
data: {
plan_id: '34ck'
}
dataType: 'jsonp',
success: function(data){
// manipulate data
}
});
Clone this repository, then run:
$ rackup
Then, open http:https://localhost:9292/
.