我有这个问题,表单刷新提交,我不想刷新,但我希望它提交。你们谁知道我能做什么?从提交刷新停止窗体
点击这里link到一个较旧的帖子关于此。
<form method="post" id="radioForm">
<?
foreach($result as $radio):
printf('
<button type="submit"
href="#radio"
name="submitRadio"
value="'.$radio['id'].'">
Go!
</button>
');
endforeach;
?>
</form>
<script type="text/javascript">
$('#radioForm').submit(function(event) {
event.preventDefault();
$.ajax({
url:'index.php',
data:{submitRadio:[radiovalue]},
type:'POST',
success:function(response) {
/* write your code for what happens when the form submit */
});
});
</script>
</div>
使用ajax表单提交。 – Vegeta 2015-03-03 13:18:31
我不熟悉ajax或Js,所以如果你可以帮我解决这个问题,那就太棒了 – 2015-03-03 13:19:19
你想提交什么? – RST 2015-03-03 13:22:35