Sunday, March 20, 2011

deleting session data via ajax

Of course we can do this, but is it alright to do so? Are there any downsides of this approach?

From stackoverflow
  • What do you mean by session data? What programming language on the server (if you are referring to session data on the server)?

    If you are using PHP, then you'll need to just call a PHP file with AJAX and delete using unset() (such as unset($_SESSION['user_id']) what ever you need to. I see this as just as risky as doing it with a normal request.

    Darryl Hein : Why the downvote?
  • There's no reason you can't do this. The only concern would be that you'd need to handle any page state changes (like removing the 'account' links, etc).

    Ygam : can I handle these state changes with remote requests?
    thenduks : Well, the remote requests don't have anything to do with stale content on the page... You do the request, it clears/invalidates the session, and then you need to get the page into a state where the user is, essentially, 'not logged in'. You just do this with javascript on the client side (say, with jQuery?). If you need more information you'll need to be more specific in your question.

0 comments:

Post a Comment