I'm trying to produce a form whereby when a check box is selected, the form is instantly submitted and results are displayed into a div located on the same page.
这是我到目前为止正在尝试的代码,但没有任何运气:
<form action="end.php" method="get">
<input name="yourcheckbox" id="yourcheckbox" value="ten" type="checkbox" onClick="testResults(this.form)"/>
</form>
<script type="text/javascript">
function(form) {
$.post($(this).attr("action"), $(this).serialize(), function(html) {
$("#someDiv").html(html);
});
return false; // prevent normal submit
};
</script>
<div id="someDiv">The results from the submitted form appears here</div>
我还需要使用具有不同值的多个复选框
关于如何去的任何建议?