submitting a form inside a modalbox with jquery
Posted
by
birdy
on Stack Overflow
See other posts from Stack Overflow
or by birdy
Published on 2012-10-16T03:32:49Z
Indexed on
2012/10/16
5:03 UTC
Read the original article
Hit count: 163
submitting form with jQuery
works
$('#testform').submit();
doesn't work
$('#testform').submit(function () {
alert('test1');
return true;
});
This is just an exmaple but at times i'd like to do stuff before submission of the form. Like for example submit the form using $.POST
Update:
If I keep both then the $.POST
has no value because the form still gets submitted the traditional way, without ajax...
$("#testform").submit(function() {
$.post('/myajaxcontroller', function(data) {
$('#result').html(data);
});
});
$("#testform").submit();
© Stack Overflow or respective owner