Skip to content

Instantly share code, notes, and snippets.

@Nitrodist
Created November 26, 2011 23:07
Show Gist options
  • Save Nitrodist/1396465 to your computer and use it in GitHub Desktop.
Save Nitrodist/1396465 to your computer and use it in GitHub Desktop.
$(function() {
$("form").submit(function() {
var q = $("#search_q").val();
if (q == "")
return false;
$.getJSON("/definitions", { q: q }, function(json) {
$("#definition_results").prepend("<li class='hidden'>" +
"<dl>" +
"<dt>" + json.title + "</dt>" +
"<dd>" + json.definition + "</dd>" +
"</dl>" +
"</li>");
$("li.hidden").show('slow');
});
return false;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment