Questions about page errors after using Ajax for login verification in PHP

Source: Internet
Author: User
What is wrong with the page after using Ajax for login verification in PHP?
I created a index.php page that was made up of three pages with the following code:












Include ("top.php");
?>

I use Ajax for login verification in main.php to show the user name in the original location after successful verification. I encountered the problem is: when the user name verification success, jump page is main.php page, how can I make her jump to index.php page, and implement login verification, and after the login verification successful, on the index.php page display user name. I am a PHP novice, seeking guidance!!! PHP Ajax Login Verification Page Jump Error

Share to:


------Solution--------------------
First, when the validation is successful PS: If no session is returned main.php
Second, do not know your login verification is written on which page, write in index.php, Ajax URL write index.php on the line
Third, the login verification success after the user name is written in the session, in the index can be displayed
------Solution--------------------
There is no jump in AJAX applications.
Once you jump, the page will need to be re-used for the content.
So you lose the meaning of using AJAX.
------Solution--------------------
References:
My Login Verification page is written on the login.php page, the verification is successful after the jump, the code is as follows:
echo "
Welcome to your ". $this->username;
Header ("location:index.php");
Exit
But the contents of the index.php have come back.
If you do not need to jump, verify success, skip to the main.php page.

Why do you want to exit?
echo "
Welcome to your ". $this->username; This sentence is not to be written in index.php?
can put $_session[username] = $this->username
Then echo in index "
Welcome to ". $_session[username";
What is the content in index to come back, there is something that can not be re-come?
  • 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.