Skip to content

Instantly share code, notes, and snippets.

@afahy
Created November 17, 2009 20:04
Show Gist options
  • Save afahy/237221 to your computer and use it in GitHub Desktop.
Save afahy/237221 to your computer and use it in GitHub Desktop.
Helper for YQL calls
// Simple YQL helper:
// $.yql({q: strQuery, callback: fnCallback });
(function($){
$.yql = function(o){
var params = $.extend({}, $.yql.options, o),
q = encodeURIComponent(o.query.toLowerCase()),
url = $.yql._url + "?q=" + q + "&format=json&callback=?";
$.getJSON(url, params.callback)
}
$.yql._url = "http://query.yahooapis.com/v1/public/yql";
$.yql.options = {
query: "",
callback: function(){}
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment