jQuery POST响应安全性

i use jquery to submit login form with the following code :

$.ajax({
type:'POST', 
url: 'register_process.php', 
data:$('#login').serialize(), 
    beforeSend: function() {
        $('#login_process').html("<img src='img/sloader.gif' />");
    },
    success: function(response) {
        $('#login_process').html(response);
        $("#navbar").load(location.href + " #navbar");
        alert(response);
        if(response="ok") {
            $(location).attr('href',"log.php"); 
        }
    }
});
return false;

and this is my php code :

`if($userlogin=='ok') {
   print 'ok';
} else
   print 'not ok';`

but I think that im not doing the proper thing, is there any other way to catch jquery post response with specific conditions from php?

thank you very much