Javascript Alert box not displaying on Firefox
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 h开发者_开发问答appen?
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?
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
.
精彩评论