PHP Session Class

前端 未结 1 707
再見小時候
再見小時候 2021-01-25 05:53

I followed the wikihow tutorial for building a secure session management system : http://www.wikihow.com/Create-a-Secure-Session-Managment-System-in-PHP-and-MySQL

and it

相关标签:
1条回答
  • 2021-01-25 06:27

    When you make the first AJAX call, the server starts a session and sends the session ID back to the browser in a cookie. In order for the second AJAX call to be in the same session, it has to send that cookie back to the server.

    But you're not waiting for the response to the first call before you send the second call. So the cookie hasn't been received, and it can't be sent with the second call. Anything that depends on the result of an AJAX call has to be done in its callback function. So you should do:

    $.get('ajax1.php', function() {
        $.get('ajax2.php');
    });
    
    0 讨论(0)
提交回复
热议问题