You can validate if the request is ajax in the action itself:
<?php
class PostsController extends Phalcon\Mvc\Controller
{
public function editAction()
{
if (!$this->request->isAjax()) {
$this->flash->error('The request is not ajax');
return;
}
//...
}
}