Last active
April 22, 2016 22:32
-
-
Save gartenfeld/56d27e073c45fdce52bfabb69cfdec40 to your computer and use it in GitHub Desktop.
YQL CORS jQuery Plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // http://james.padolsey.com/snippets/cross-domain-requests-with-jquery/ | |
| // enableCORS(); | |
| var enableCORS = function() { | |
| jQuery.ajax = (function(_ajax){ | |
| var api = 'http://query.yahooapis.com/v1/public/yql', | |
| query = 'select * from html where url="{URL}"'; | |
| return function(o) { | |
| var q = query.replace('{URL}', o.url); | |
| o.url = api; | |
| o.dataType = 'json'; | |
| o.data = { | |
| q: q, | |
| format: 'json' | |
| }; | |
| return _ajax.apply(this, arguments); | |
| }; | |
| })(jQuery.ajax); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment