【发布时间】:2012-07-18 14:27:37
【问题描述】:
我正在尝试制作一个表单,在选中复选框时,立即提交表单,结果显示为位于同一页面上的div。
这是我目前正在尝试的代码,但没有任何运气:
<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>
我还需要使用多个具有不同值的复选框
有什么建议吗?
【问题讨论】: