$( "#maLogout" ).on( "click", function( event ) { $.ajax({ type: "DELETE", url: "/auth/login", data: "session=remove", success: function (url) { var win = event.target.ownerDocument.defaultView || event.target.ownerDocument.parentWindow; win.location.href = url; } }); }); $( "#maLogin" ).on( "click", function( event ) { var win = event.target.ownerDocument.defaultView || event.target.ownerDocument.parentWindow; win.location.href = "/auth/login/AAF"; });