Skip to content

Instantly share code, notes, and snippets.

@mwilliams
Forked from bkmorse/gist:111660
Created May 14, 2009 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mwilliams/111662 to your computer and use it in GitHub Desktop.
Save mwilliams/111662 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#form_div').submit(function() {
var inputs = [];
$(':input', this).each(function() {
inputs.push(this.name + '=' + escape(this.value));
})
// Adding a comment here to show a commit change.
jQuery.ajax({
data: inputs.join('&'),
url: this.action,
timeout: 2000,
error: function() {
console.log("Failed to submit");
},
success: function(r) {
console.log("Posted successfully.");
}})
return false;
})
});
</script>
</HEAD>
<BODY>
<div id="form_div">
<form id="my_form" action="ajax_sample.html" method="POST" accept-charset="utf-8">
<textarea name="text" rows="8" cols="40"></textarea>
<p><input type="submit" id="submit_button" value="Continue &rarr;"></p>
</form>
<div>
</BODY>
</HTML>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment