jquery form post code example
Example 1: jquery submit form
// It is simply
$('form').submit();
// However, you're most likely wanting to operate on the form data
// So you will have to do something like the following...
$('form').submit(function(e){
// Stop the form submitting
e.preventDefault();
// Do whatever it is you wish to do
//...
// Now submit it
// Don't use $(this).submit() FFS!
// You'll never leave this function & smash the call stack! :D
e.currentTarget.submit();
});
Example 2: $post in jquery
$(function(){
$('#myForm').on('submit', function(e){
e.preventDefault();
$.post('http://www.somewhere.com/path/to/post',
$('#myForm').serialize(),
function(data, status, xhr){
// do something here with response;
});
});
});
Example 3: when a form is subbmited jquery
$("#myform").submit(function(e) {
})
Example 4: html form post
<form action="/yourPage" method="post">
</form>