繁体   English   中英

为什么此脚本在Chrome中有效,但在Firefox中无效?

[英]Why does this script work in Chrome but not in Firefox?

我有此脚本,但它仅在Chrome中有效。 不能在Firefox中工作可能是什么问题?

<script type="text/javascript">
$(function() {
    $('form').submit(function() {
        $.post('/parts', function() {
            window.location = '/parts';
        });
    });
});
</script>

尝试将其更改为:

    $('form').submit(function(e) {
        e.preventDefault();
    $.post('/parts', function() {
            window.location.href = '/parts';
        });
    });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM