Refresh PHP SESSION var after AJAX request

前端 未结 2 730
甜味超标
甜味超标 2021-01-23 17:28

I\'ve index.php and callSession04.php. When index.php does an AJAX request PHP SESSION variables are set on callSession04.php

2条回答
  •  花落未央
    2021-01-23 18:14

    The session state is on the server, your code updates it on the server correctly (I assume). What you experience is the representation of the server state (index.php) is not updated on the client (browser) after the Ajax call.

    You have multiple options to fix that:

    • Use the ajax callback to reload the current page (index.php)
    • Use the ajax callback to update the current page (DOM manipulation) to reflect the server state

    This can not be fixed in the php (server side) alone.

提交回复
热议问题