AuthenticationService's logout() Method Example

Listing 2. Using the AuthenticationService class's logout() method to log a user out of a site. Calling the logout() method will cause a full-page postback operation to occur.

function Logout()
{
  Sys.Services.AuthenticationService.logout(null, 
   OnLogoutCompleted, OnLogoutFailure, null);
}?
function OnLogoutCompleted(result)
{
  alert("You have been logged out!");
}

function OnLogoutCompleted(result)
{
  alert("You have been logged out!");
}
?function OnLogoutFailure(error,userContext,methodName)
{
  alert("Unable to log out: " + error.get_message());
}