PHP header() called via AJAX not working properly

后端 未结 4 1039
轮回少年
轮回少年 2021-01-25 06:29

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

4条回答
  •  甜味超标
    2021-01-25 07:22

    You can one thing replace your code header("Location: profile.php"); by echo "window.location.href='profile.php'; and replace your success function as

         if(obj.status == 200) {
             eval(obj.responseText);
         }
    

    Thats it. now a response will be evaluated by script and will redirect your page on profile.php

提交回复
热议问题