Javascript-ajaxsession refresh

Source: Internet
Author: User
I want to use ajax to achieve no refreshing logon. I want to display the User Name of the current logon on the page after the logon is complete. The user name is stored in the background through session, but after each successful login, the session can only be displayed after the page is refreshed! Solution: I want to use ajax to achieve no refreshing logon. I want to display the user name currently logged on the page after the logon is complete. The user name is stored in the background through session, however, after each successful login, the session is directly blank and can only be displayed after the page is refreshed! Solutions

Reply content:

I want to use ajax to achieve no refreshing logon. I want to display the User Name of the current logon on the page after the logon is complete. The user name is stored in the background through session, but after each successful login, the session can only be displayed after the page is refreshed! Solutions

This problem should not occur. You may try to add the username and other information you need when the logon is successful.

I just want to ask you why you didn't click the new page to display the user name?
You can replace HTML code with a user name in the return value of ajax with js.

In addition, you store the user name in the SESSION in Ajax, and you cannot obtain the value without refreshing it.

After the background login verification is successful, save the username and other information of the logged-on user to the SESSION, and save a copy in the ajax return value.

Didn't you add the new value innerhtml to the user name location?
The specific description is as follows.

Put your code up and look at it. You may not be able to retrieve the value after refresh, because the session value returned by the background can be obtained after successful login, so it is your code problem. If you say so, we do not know where to start. To solve the bug, we must check the code and the feedback of the bug information to know where the specific problem is.

Thank you for your support. I have solved the problem. Thank you !!

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.