I am creating a user authentication system using PHP, JQuery, and AJAX. On submit, a request will be sent to 'authenticate.php' with data: `username` & `password` using AJAX. The PHP code checks a database for the record and returns 0 on `success`, 1 on `failure`. Then if the returned value is 0, the page will be redirected to the 'user private page' using `'window.location="user.php"'`.

Now, the question is, is it safe and proper way to authenticate like this? Are there any security problems to use jQuery/JavaScript to redirect page?