سؤال

Whenever the user clicks logout from my website's page I log him out on server (destroy session and autologin token). Should I refresh the page or I can just update header part where the user name is displayed?

هل كانت مفيدة؟

المحلول

You can just update the part that displays the current logged in username. Any links then followed will be then accessed in the logged out state since the cookie will now be cleared (assuming authentication is done via cookies).

نصائح أخرى

Well, since we are talking about web... JavaScript, jQuery and AJAX might be the answer to your question. Just send the logout request through AJAX, validate the answer and then with jQuery or JavaScript remove/hide the header part.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top