views:

195

answers:

2

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?

+1  A: 

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.

T.J. Crowder
What bugs me though, is that it works fine on IE. That tells me that Ajax is parsing the "msg".
Uran
And thx for the Firebug, Now I see that FF is skipping the "success" clause completely. Any ideas?
Uran
@Uran: Yes, all that means is that the results are different in one vs. the other. Walking through it with Firebug may help you figure out *why* that would be the case. :-) There are sufficient differences between browsers that this sort of thing comes up all the time. Good luck with it.
T.J. Crowder
A: 

Ahhhhhhhhhh! mine doesnt work!

Anoni Mouse