[jQuery] How can I make diferent things depending on the 'msg' variable?

[jQuery] How can I make diferent things depending on the 'msg' variable?


Hi,
The fact is, I want to have diferent functions depending on the 'msg'
variable.
For example, if the msg variable is "error" i want son events to hapen
a some other events not.
My code is this:
$('#login').ajaxForm({
             url: 'revisar.php',
             beforeSubmit: function() {
$('#loginCaja').html('Por favor espere...');
},
        success: function(msg) {
            $('#loginCaja')
            .fadeIn('slow',function(){
                                    });
            if(msg=='error'){
            $('#loginCaja').html('Usuario incorrecto');
            }
            else {
            $('#loginCaja').html(msg);
            }
            $('#registroBox').fadeOut('slow');
            }
            ,
            error: function() {
            $('#loginCaja')
            .fadeIn('slow',function(){
                                    })
            .html('Error');
            }}
);
});
I wrote an if clause in the msg variable, but this doesnt works, it
alwals like if the if is false.
How can i make this work?
I have jQuery library and jQuery.form library.
Sorry for my english, i am from argentina.
Thanks in advance