php - wordpress losing the session on page refresh -
I am trying to develop a plugin for WordPress and I have a small problem with the session. I have created my login page for my plugin and when the user enters his username / password and presses the login button, then the AJAX request sends data to a function so that it can check whether the user details are correct or not. The AJAX caller function is stored in my index.php of my plugin. Using $ _SESSION in the function that Ajax is calling, I can print the variable that I want, which is set in another file. Then if the data is correct then the AJAX page reloads. When the page has been reloaded, then the session will not exist any more. Does anyone know how I can solve this problem? I implemented a plug-in on a localized server that was working fine, but when I was uploading the project to a subdomain on a server, it stopped working.
AJAX code
Success: function (data) {console.log (data); If (data! = '') {Var obj = $ .parseJSON (data); If (obj.status == "OK") {location.reload (); }}
thanks
You try to use this Is the RememberState function with your AJAX call? Usually this can be applied to a form (so if this form is partially filled and the user is refreshed on their page then their changes are preserved), but in theory I do not know that you use it Do it yourself on the document. See this link, then it can be understood more clearly
You want to do this before the call, and in the success callback, you can use this remastest to use it You should be able to return to the already active session if it is not that you are referring to apologizing for the wrong interpretation of your question.
Comments
Post a Comment