我想通过单击提交按钮以外的元素来提交表单,在这种情况下是
. 我以为我可以这样做,但是表单不会在单击事件上提交,而是会在我单击提交按钮时提交。
HTML
提交
JQ $(document).ready(function() {
$('p').click(function() {
$('form').submit(function(data) {
alert($(this).serialize()); // check to show that all form data is being submitted
$.post("serializearray.php",$(this).serialize(),function(data){
alert(data); //post check to show that the mysql string is the same as submit
});
return false; // return false to stop the page submitting.
});
});
})