Redirection Still not working (updated on earlier question)

Posted by NoviceCoding on Stack Overflow See other posts from Stack Overflow or by NoviceCoding
Published on 2011-01-11T04:35:30Z Indexed on 2011/01/11 4:54 UTC
Read the original article Hit count: 156

Filed under:
|

So earlier I asked this question: JQuery Login Redirect. Code Included

The php file is sending the following:

$return['error'] = false;
$return['msg'] = 'You have successfully logged in!!';

I've tried all the suggestions, quoting the error on php and ajax end, 2 equals instead of 3, I've also tried DNE true which should be the same as an else statement:

$(document).ready(function(){
$('#submit').click(function() {
$('#waiting').show(500);
$('#empty').show(500);
$('#reg').hide(0);
$('#message').hide(0);

$.ajax({
    type : 'POST',
    url : 'logina.php',
    dataType : 'json',
    data: {
        type : $('#typeof').val(),
        login : $('#login').val(),
        pass : $('#pass').val(),


    },
    success : function(data){
        $('#waiting').hide(500);
        $('#empty').show(500);
        $('#message').removeClass().addClass((data.error === true) ? 'error' : 'success')
            .text(data.msg).show(500)
        if(data.error != true) 
            window.location.replace("http://blahblah.com/usercp.php");      
        if (data.error === true)
            $('#reg').show(500);
            $('#empty').hide()
    },

    error : function(XMLHttpRequest, textStatus, errorThrown) {
        $('#waiting').hide(500);
        $('#message').removeClass().addClass('error')
            .text("There was an Error. Please try again.").show(500);
        $('#reg').show(500);
        $('#empty').hide();
                            Recaptcha.reload();

    }
});

return false;

});

And it still wont work. Any ideas on how to make a redirection work if login is successful and error returns false? Also while I am asking, can I put a .delay(3000) 3s at the end of window.location.replace("http://blahblah.com/usercp.php")?

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery