Skip to content

Instantly share code, notes, and snippets.

@cgrusden
Created September 27, 2012 18:55
Show Gist options
  • Save cgrusden/3795738 to your computer and use it in GitHub Desktop.
Save cgrusden/3795738 to your computer and use it in GitHub Desktop.
Save data when a form posts
<script>
$(document).ready(function() {
$('form:first').bind('submit', function() {
search = $(this).find('.input_text').val();
$.get(['https://serveletserve.herokuapp.com/PUBLIC_API_TOKEN_1234/track/twitter/cgrusden/searched_for', search].join("/"));
});
});
</script>
<html>
<body>
<form>
Term to search for?<input name="search_term" class="input_text"/>
<input type="submit"/>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment