I\'m new to web development.
Right now I\'m working on a login feature on a site. I used Javascript/AJAX to fetch the username and password and send it to a PHP file for
I don't think the redirect will work with AJAX. This is what will happen:
login.phplogin.php sends back a header with Location: profile.phpprofile.phpprofile.php is then passed to your XMLHttpRequest Object.A way to get the AJAX response to redirect your page is to do this:
The response from login.php returns a JSON response containing the status code (302 or 301) and the location to redirect to.
The response itself has a status code of 200 (successful).
The process the JSON response and check the status code for 302 or 301 and redirect to the location.