Skip to content

Instantly share code, notes, and snippets.

@rcarver
Created February 3, 2009 19:01
Show Gist options
  • Save rcarver/57676 to your computer and use it in GitHub Desktop.
Save rcarver/57676 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
$('form').submit(function() {
var q = $("input#q").val();
$.getJSON("http://en.wikipedia.org/w/api.php?callback=?", {
search: q,
action: "opensearch",
format: "json" },
function(result) {
var suggestions = result[1];
$.each(suggestions, function(i, suggestion) {
$('#message').append("<li>" + suggestion + "</li>");
});
});
return false;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment