Hi, I have the following which should be working fine and when the correct details are entered the variable for cek does return a 1 and when not returns a 0 however it should redirect when 1 is returned but doesn't, it just says login incorrect all the time. $(document).ready(function() { $('#logins').click(function() { var iduser = $('#email_address').val(); var pass = $('#password').val(); $("#status").html('<img src="images/loader.gif" />Logging In...'); $.ajax({ type: "POST", url: "index.php?action=login&", data: "email_address="+ iduser +"&password=" + pass, success: function(cek){ if(cek == 1) { //if user is available! set user session here window.location.href = 'members.php'; } else { // user not available $("#status").hide(); $("#status").fadeIn(300).html('<font color="red">Login Incorrect</font>'); return false; } } }); return false; }); }); PHP:
Are you sure cek is an integer? I didn't try it, but maybe you could try parseInt(cek) == 1, of cek == "1"