Created
September 6, 2011 18:50
-
-
Save montague/1198598 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript" charset="utf-8"> | |
$(function(){ | |
$('#submit_button').click(function(){ | |
var url = "/post/to/this/url"; | |
$.post(url, $('form').serialize(), function(responseData, ajaxStatus){ | |
//this is the callback function that fires upon completion of the ajax post request | |
//the 'data' parameter holds whatever the server returned in response to to the post request | |
//here, i am assuming the server returns a message that is intended to be displayed to the user ("missing data", "info submitted", etc) | |
$('#status').text(data); | |
}); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<form> | |
<input id="fuck" name="fuck"/> | |
<input id="you" name="you"/> | |
</form> | |
<div id="status">waiting...</div> | |
<button id="submit_button">submit some shit</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment