separate templates from static files
[myslice.git] / auth / static / js / logout.js
diff --git a/auth/static/js/logout.js b/auth/static/js/logout.js
new file mode 100644 (file)
index 0000000..1e140a9
--- /dev/null
@@ -0,0 +1,10 @@
+/* retrieve username from the button that is clicked, the one named 'logout' 
+   and that is expected to have the 'username' attribute */
+function logout () {
+    var username=$(this).attr('username');
+    var msg="Are you sure you want to logout as " + username + " ?";
+    /* redirect to /logout, see urls.py */
+    if (confirm(msg)) window.location="/logout/";
+}
+/* attach this function to the logout button */
+$(document).ready(function() { $('#logout').click(logout); })