function logoutThenRedirect() { $.post("/logout").done(function(data) { window.location.replace("/"); }); }