Problems related to page errors after using ajax for login verification in php

Source: Internet
Author: User
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:












Include ("top. php ");
?>

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?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.