public function onAjax(GetResponseForControllerResultEvent $event) {
$page_callback_result = $event
->getControllerResult();
// Construct the response content from the page callback result.
$commands = ajax_prepare_response($page_callback_result);
$json = ajax_render($commands);
// Build the actual response object.
$response = new JsonResponse();
$response
->setContent($json);
return $response;
}