diff --git a/module/VuFind/src/VuFind/Controller/AjaxResponseTrait.php b/module/VuFind/src/VuFind/Controller/AjaxResponseTrait.php index f243a9a289e3615d9257063b86408e3546a9be49..8f3212ffb219a09604ff82176d4913cacaeaeeef 100644 --- a/module/VuFind/src/VuFind/Controller/AjaxResponseTrait.php +++ b/module/VuFind/src/VuFind/Controller/AjaxResponseTrait.php @@ -75,6 +75,7 @@ trait AjaxResponseTrait { switch ($type) { case 'application/javascript': + case 'application/json': $output = ['data' => $data]; if ('development' == APPLICATION_ENV && count(self::$php_errors) > 0) { $output['php_errors'] = self::$php_errors; @@ -141,7 +142,7 @@ trait AjaxResponseTrait * * @return \Laminas\Http\Response */ - protected function callAjaxMethod($method, $type = 'application/javascript') + protected function callAjaxMethod($method, $type = 'application/json') { // Check the AJAX handler plugin manager for the method. if (!$this->ajaxManager) { diff --git a/module/VuFind/src/VuFind/Controller/SearchController.php b/module/VuFind/src/VuFind/Controller/SearchController.php index 81ffdddd6e9c129d58869a981d064d14b1af2495..f5cd7d7d0ae44d00bf0743e40e4ca329991e418a 100644 --- a/module/VuFind/src/VuFind/Controller/SearchController.php +++ b/module/VuFind/src/VuFind/Controller/SearchController.php @@ -488,7 +488,7 @@ class SearchController extends AbstractSolrSearch // Send the JSON response: $response = $this->getResponse(); $headers = $response->getHeaders(); - $headers->addHeaderLine('Content-type', 'application/javascript'); + $headers->addHeaderLine('Content-type', 'application/json'); $response->setContent( json_encode([$query->get('lookfor', ''), $suggestions]) );