addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupsimageimagesinstagramlinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1outlookpersonStartprice-ribbonImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruseryahoo

announcement: JSONProxy

From: Aidan F.
Sent on: Thursday, November 8, 2012 12:50 AM
Hey all-
I had a project at work (jux.com) where I was adding client-side metadata fetching for videos.  Both Vimeo and Youtube offer oEmbed APIs, but Youtube doesn't have-cross domain support, CORS doesn't work in older browsers, blah blah blah.

I built a little service in Node to proxy requests to APIs that don't support CORS or JSONP (which I demoed at Hack&Tell a while ago), but just wrote a little jQuery plugin that wraps jQuery.ajax() to handle the browser detection and proxy configuration for you (where necessary).  This means painless requests in any browser to any URL.

$.jsonp({
  url: 'http://jsonview.com/example.json', // any JSON endpoint
  corsSupport: true, // if URL above supports CORS (optional)
  jsonpSupport: true, // if URL above supports JSONP (optional)

  success: function(data){
    alert(data.awesome);
  }
  // error, etc.
});


Hope it comes in handy for someone else!  More info here:


Thanks!
-Aidan

Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy