3419b9d240642a052f10e66c32616421e7766b74
[myslice.git] / auth / static / js / logout.js
1 /* retrieve username from the button that is clicked, the one named 'logout' 
2    and that is expected to have the 'username' attribute */
3 function logout () {
4     var username=$(this).data('username');
5     var msg="Are you sure you want to logout as " + username + " ?";
6     /* redirect to /logout, see urls.py */
7     if (confirm(msg)){
8         localStorage.clear();
9         window.location="/logout/";
10     }
11 }
12 /* attach this function to the logout button */
13 $(document).ready(function() { $('#logout').click(logout); $('#logoutbtn').click(logout); });