Jquery.getjson () session inconsistency problem

Source: Internet
Author: User
Hello everyone, I am a novice php, recently made a website, I use the following code asynchronous request to register.php, but register.php and login.php print out the SessionID is inconsistent, have encountered this problem before, Is the jquery version is too low, but now change the highest version also has this problem, which expert to help me solve.

$.getjson ("register.php", {username:username},function (data) {
$ ("#lgform"). Submit (); Submit to Login.jsp
});


Reply to discussion (solution)

The session does not seem to have anything to do with jquery, probably because your code is problematic. Can be posted for analysis.

Seems to have a relationship, I have met before, its code is very simple, the session is configured in the conf.php file, in register.php and login.php are introduced

conf.php file
Ini_set (' session.cookie_domain ', ' localhost ');
Session_Start ();
$sessionId = session_id ();

Register.php after receiving the data
$_session["username"] = $username;

After jquery returns data, request to login.php
$_session[' username ' data is empty, login.php's SessionID is inconsistent with register.php's SessionID

No one can answer this question, so few masters

Please give the complete test code, you can not let others write code to verify your impossible problems.

This should be only in IE under the existence of it!
Source of the problem:
Ie6/ie7 supported P3P (Platform for Privacy Preferences Project (P3P) specification) protocol By default prevents third-party cookies that do not have a privacy security statement, Firefox does not currently support P3P security features, and there is no natural problem with Firefox. Mircosoft specific descriptions of this can be found in the Privacy in Internet Explorer 6
The workaround is to output P3P's host header declaration when the server responds:
To a link Baidu Library
Http://wenku.baidu.com/view/ea504514866fb84ae45c8d2c.html
Put a C # code: In the Ajax login page **.ashx code to add
if (context. Request.Browser.Browser.ToUpper (). Contains ("IE"))
Context. RESPONSE.HEADERS.ADD ("P3P", "Cp=cao PSA our");

  • 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.