PHP CAKE 5, ajax call

Is there a change in PHP CAKE 5, if I call ajax - then the template default.php and not ajax.php is loaded automatically?

If I put this in AppController.php

    public function beforeFilter(EventInterface $event)

        if ($this->request->is('ajax')) {

it works correctly. It worked automatically in PHP CAKE 4.x, any advice?

I found where the change was: 4.4 Migration Guide - 4.x

can you show the full code? I am stuck in ajax in CakePHP 5

Code of what exactly?

I am still getting an error Template missing.