Why is an error on the page after ajax is used for login verification in php? I created an index. php page, which is composed of three pages. the code is as follows: & lt; table & nbsp; cellpadding0 & nbsp; cellspacing0 & gt; & nbsp; & lt; error on the page after ajax is used in tr & nb php for login verification?
I created an index. php page, which is composed of three pages. the code is as follows:
I use ajax in main. php for login verification. after the verification is successful, the user name is displayed in the original location. The problem I encountered is that after the user name is verified successfully, the main page is displayed. on the php page, how can I redirect her to index. php page, and implement login verification, and after the login verification is successful, in the index. the php page displays the user name. I am a php Cainiao. thank you !!!
An error occurred while redirecting to the PHP Ajax login verification page.
Share:
------ Solution --------------------
First, after the verification is successful, script window. location. href = "index. php" script PS: If no session exists, main. php is returned.
Second, I don't know which page your login verification is written in. if it is written in index. php, you just need to write index. php in the Ajax URL.
Third, after successful login verification, write the user name in the session, and the user name will be displayed in the index.
------ Solution --------------------
There is no jump in AJAX applications.
Once the page is redirected, all the content used on the page must be accessed again.
In this way, the significance of using ajax is lost.
------ Solution --------------------
Reference:
My login verification page is written in the login. php page. after the verification is successful, the page Jumps. the code is as follows:
Echo"
Welcome to ". $ this-> username;
Header ("location: index. php ");
Exit;
However, the content in index. php has come back.
If you do not need to jump, after the verification is successful, jump to the main. php page.
Why exit?
Echo"
Welcome to ". $ this-> username; isn't this sentence written in index. php?
You can set $ _ SESSION [username] = $ this-> username
Then echo"
Welcome to ". $ _ SESSION [username];
What is the content in the index? is there anything in the index that cannot be retried?