src/Neutrino/Http/Middleware/Ajax.php
public function before(Event $event, $source, $data = null)
    {
        if (isset($_SERVER["HTTP_X_REQUESTED_WITH"]) && "xmlhttprequest" === strtolower($_SERVER["HTTP_X_REQUESTED_WITH"])) {
            return true;
        }

        $this->response->setStatusCode(400, 'Bad Request');

        return false;
    }
public function before(Event $event, $source, $data = null)
    {
        if (isset($_SERVER["HTTP_X_REQUESTED_WITH"]) && "xmlhttprequest" === strtolower($_SERVER["HTTP_X_REQUESTED_WITH"])) {
            return true;
        }

        $this->response->setStatusCode(400, 'Bad Request');

        return false;
    }
Called before the execution of handler

@param \Phalcon\Events\Event     $event
@param \Phalcon\Dispatcher|mixed $source
@param mixed|null                $data

@throws \Exception
@return bool