On a fresh install of 3.3.12, I tried to get JSON data from my project. According to the manual, putting this in my function (controller action) should be enough, except that I keep getting a “view missing” error.
public function jsonGet() {
// Set the view vars that have to be serialized.
$this->set('tags', $this->paginate());
// Specify which view vars JsonView should serialize.
$this->set('_serialize', ['tags']);
}
AppController::initialize() looks like this:
public function initialize() {
parent::initialize();
$this->loadComponent('RequestHandler');
$this->loadComponent('Flash');
}
In the request an Accept-header is sent, with “application/json, text/javascript, /; q=0.01”.
What am I missing?