Ajax Action mit json Rückgabe

Hallo Leute

ich bekomme ein parsererror bei meine Ajax Action mit json
Mein Kontroller:
protected $supportedMediaTypes = array(‘application/json’, ‘text/html’);
/**
* @var string
*/
protected $viewFormatToObjectNameMap = array(
‘html’ => ‘TYPO3\Fluid\View\TemplateView’,
‘json’ => ‘TYPO3\Flow\Mvc\View\JsonView’
);

public function getdataAction() {
$data = array(“testKey”=>‘ss’, “testKey2”=>“testValue2”);
return json_encode($data);
}
/**

  • @return void
    */
    public function indexAction() {
    #$this->view->assign(‘bookings’, $this->bookingRepository->findAll());
    }

Mein Routes.yaml

  • name: ‘HHotels REST API Proxy’
    uriPattern: ‘‘
    defaults:
    @package’: ‘Booking.Widget’
    @controller’: ‘Booking’
    @format’: ‘json’
    @action’: ‘getdata’

Mein View: Index.html

Kann jemand mir helfen warum obwohl der AJAX request 200 zurück gibt ein parsererror gibt?

Hey @ariane,

Please stick to English or post to the german part of this forum (https://discuss.neos.io/c/community/german-community). And please mention the expected and the actual behavior.
In this case: Where do you get what error exactly?