Javascript 警报框在 Firefox 上不显示

发布于 2024-08-21 06:10:33 字数 900 浏览 4 评论 0原文

好的, 所以我有这个脚本,它可以在 IE 中正常工作,但不能在 Firefox 中工作。所以我想知道是否有人遇到过这个问题并且也许找到了解决方案。

$.ajax({ 
        type    : "POST",
        url     : "../php/insertUser.php",
        data    : dataString,
        success : function(msg, status)
        {
            var reply = parseInt(msg);
            if(reply==1)
            {
                alert('Email address already exists in our members database.\n'+
                       'Please try another   address and then submit it again!');
            }
            else if(reply==2)
            { 
            }
            else if(reply==0)
            {
                $('#pForm').hide('fast');
                $('#accForm').show('slow');
            }
       }
  });      

因此,警报在 IE 上运行良好,但我无法让它们在 Firefox(3.6 或更早版本)上运行。关于为什么会发生这种情况有什么想法吗?

编辑:感谢 TJ 向我推荐 Firebug,现在我发现警报不是问题。问题在于 Firefox 没有读取“success:”子句。有什么想法吗?

Okay,
so I have this script which works fine with IE but won't work with Firefox. So I was wondering if anyone has had this problem and maybe got a solution.

$.ajax({ 
        type    : "POST",
        url     : "../php/insertUser.php",
        data    : dataString,
        success : function(msg, status)
        {
            var reply = parseInt(msg);
            if(reply==1)
            {
                alert('Email address already exists in our members database.\n'+
                       'Please try another   address and then submit it again!');
            }
            else if(reply==2)
            { 
            }
            else if(reply==0)
            {
                $('#pForm').hide('fast');
                $('#accForm').show('slow');
            }
       }
  });      

So, the alerts are working fine on IE but I can't get them to work on Firefox (3.6 or earlier). Any ideas as why this might happen?

EDIT: Thanks to TJ for referring me to the Firebug, now I see that the alerts are not the problem. The problem lies in that Firefox is not reading the "success:" clause. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

饭团 2024-08-28 06:10:33

据人们所见,警报没有任何问题(一旦我重新格式化代码以使其可读!;-))。我的建议是获取 Firebug 并单步执行代码,看看哪里失败了。例如,您没有看到警报的最可能原因是 Ajax 调用失败,或者您在解析 msg 时从未获得 reply = 1

There's nothing wrong with the alert as far as one can see (once I reformatted the code to make it readable! ;-) ). My suggestion is to get Firebug and step through the code, seeing where it's failing. For instance, the most likely reasons you're not seeing the alert are that the Ajax call is failing or you're never getting reply = 1 from parsing msg.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文