简体   繁体   English

Firefox上未显示Javascript Alert框

[英]Javascript Alert box not displaying on Firefox

Okay, so I have this script which works fine with IE but won't work with Firefox. 好的,所以我有这个脚本,它可以在IE上正常运行,但不能在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). 因此,警报在IE上运行正常,但我无法在Firefox(3.6或更早版本)上运行它们。 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. 编辑:感谢TJ将我引向Firebug,现在我看到警报不是问题。 The problem lies in that Firefox is not reading the "success:" clause. 问题在于Firefox无法读取“ success:”子句。 Any ideas? 有任何想法吗?

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. 我的建议是获取Firebug并逐步遍历代码,查看失败的地方。 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 . 例如,您没有看到警报的最可能原因是Ajax调用失败,或者您从解析msg永远不会得到reply = 1

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

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