Skip to content

Instantly share code, notes, and snippets.

@johnvilsack
Created August 6, 2012 17:36
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 johnvilsack/3276995 to your computer and use it in GitHub Desktop.
Save johnvilsack/3276995 to your computer and use it in GitHub Desktop.
<script>
$('#formSearch').submit(function(e)
{
// Prevent default HTML Submit
e.preventDefault();
var postSearchTerm = $("input:text[name=formSearchTerm]").val();
// Fetch JSON
$.getJSON('process.php', { q: postSearchTerm }, function(data)
{
for (var i in data.objects)
{
// Parse Return
output =data.objects[i].ITEM_ID + "<br>";
}
// Stick in div
document.getElementById("returnSearchResult").innerHTML=output;
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment