我有一个表单,但我必须单击两次按钮才能提交。我的代码是:
<script>
function processorform(id)
{
jQuery('.sp-poll-'+id+' form').submit(formProcess);
function formProcess(e)
{
e.preventDefault();
var poll = id;
answer = $('input[name=answer]:checked').val(),
div = $(this).parent(),
action = $(this).attr('action');
$(this).show();
updatePoll(action, poll, answer);
$("#poll-"+id).hide();
}
}
</script>
表格:
<form method="post" action="<?php echo $postFile;?>" class="format" id="spe_form-<?php echo $pollid; ?>" onsubmit="processorform('<?php echo $pollid; ?>');return false;">
<input type="hidden" name="poll" value="<?php echo $pollid; ?>"/>
<input type="hidden" name="backurl" value="<?php echo $thisPage; ?>"/>
</form>
一切正常,除了必须点击两次提交。