javascript - Is there any good way to expiry the session during ajax request?
阿神
阿神 2017-05-16 13:01:18
0
5
386

The session expired after the front-end Ajax request returned the HTML code. The back-end was developed with PHP. Is there any good way to solve it?

阿神
阿神

闭关修行中......

reply all(5)
为情所困

The session expired return html code can be customized. Determine whether the session has expired before returning html

習慣沉默

Return to json, the front-end will prompt to log in after global interception

刘奇

Return to the corresponding status. When the front-end determines the status, if the session fails, a prompt box will pop up. When the user presses OK, the login interface will be redirected

左手右手慢动作

Every time you make a request, you must determine whether the session has expired, that is, determine the user's login status. If it expires, return a custom error code, such as returning 400, illegal user request, etc.

I don’t know what you mean? Are you saying that information can be obtained even if the user is not logged in?

習慣沉默

The PHP interface returns the corresponding status value, success is 1, failure is 0 and carries an error message. The previous ajax process is based on the return value. When the status is 1, the data is rendered. Otherwise, the corresponding error message pops up and the corresponding jump login is performed. page operations.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template