Skip to content

Instantly share code, notes, and snippets.

@johtso
Created June 12, 2011 00:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johtso/1021119 to your computer and use it in GitHub Desktop.
Save johtso/1021119 to your computer and use it in GitHub Desktop.
Interact with OpenKeyval via YQL
###
Putting trust in Yahoo rather than OpenKeyval.
Probably not useful, just did it to see if it was possible.
###
okvGet = (key, callback) ->
yql_query = "select * from html where url='https://secure.openkeyval.org/#{key}' and xpath='/html/body/p/text()'"
$.ajax
url: 'https://query.yahooapis.com/v1/public/yql',
data:
q: yql_query,
format: 'json'
dataType: 'jsonp',
success: callback
okvPost = (data, callback) ->
postData = $.param(data)
yql_query = "select * from htmlpost where url='https://secure.openkeyval.org/' and postdata='#{postData}' and xpath='/html/body/p/text()'"
$.ajax
url: 'https://query.yahooapis.com/v1/public/yql',
data:
q: yql_query,
format: 'json',
env: 'store://datatables.org/alltableswithkeys'
dataType: 'jsonp',
if callback? then @.success = callback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment