Javascript 警报框在 Firefox 上不显示
好的, 所以我有这个脚本,它可以在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据人们所见,警报没有任何问题(一旦我重新格式化代码以使其可读!;-))。我的建议是获取 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 parsingmsg
.