Alerts are displayed in Chrome and Explorer, but not in Firefox
<p>I have a code that works correctly and displays the alerts in Chrome and Explorer but not in Firefox. However, the function do his works correctly in Firefox, but the alerts are not displayed or displayed very fast and I can't click the "Ok" button of then. Any help I receive I'll be gratefull. Sorry for mi english, it's not my native language. Here is the code. The alerts are "ALERT ONE" and "ALERT TWO".
'</p>

<pre><code>        $.ajax({
            type: "POST",
            url: direccion,
            dataType: 'json',
            data: post,
            success: function(data) {
                document.location = direccion;
                if(data.valid == 0) {
                    alert('ALERT ONE');
                } else if(data.valid == 1) {
                    alert('ALERT TWO');
                } else {

                }
                document.location = "autenticacion.php";
            },
            error: function(xhr, ajaxOptions, thrownError) {

            }
        });
</code></pre>
