isXmlHttpRequest() public static method

Returns true if the request is an AJAX request.
public static isXmlHttpRequest ( ) : boolean
return boolean
Example #1
0
 /**
  * Redirects to Login form with error message.
  * Listens to User.isNotAuthorized hook.
  */
 public function noAccess(Exception $exception)
 {
     $frontController = FrontController::getInstance();
     if (Common::isXmlHttpRequest()) {
         echo $frontController->dispatch('Login', 'ajaxNoAccess', array($exception->getMessage()));
         return;
     }
     echo $frontController->dispatch('Login', 'login', array($exception->getMessage()));
 }