【发布时间】:2015-10-27 21:52:05
【问题描述】:
我在表单上有这种情况:
<form id="boxselection" method="POST" action="select.php">
<label class="labels" for="boxtype">
<input type="radio" name="boxtype" value="3x80">
<img src="...">
</label>
<label class="labels" for="boxtype">
<input type="radio" name="boxtype" value="4x80">
<img src="...">
</label>
</form>
<script>
$('.labels').on('click',function() {
$('#boxselection').submit();
});
</script>
在 Chrome、Firefox 和 IE 中一切正常,在 Safari 中 PHP 脚本不接收任何 POST 值。
一种可行的解决方法是以这种方式修改 javascript:
<script>
$('.labels').on('click',function() {
setTimeout( function() {
$('#boxselection').submit();
}, 1000);
});
</script>
这正在工作,我的问题是......为什么?
【问题讨论】:
-
很奇怪,因为没有
setTimeut方法 8-) -
刚刚尝试了没有“解决方法”的代码,它在 safari 上运行。您使用的是哪个操作系统?您使用的是哪个版本的 Safari?
-
Yosemite 在 MacBook Air 上,预装 Safari。去检查确切的版本,让你知道
-
@Coulton 当然是错字,已更正
-
我只是在开玩笑 :o) 希望我的回答有帮助。
标签: javascript php jquery html safari