I have an issue after drupal update to version 10 with Revolution Slider. This is an error I get:

Exception Error: "Call to undefined method Drupal\\\\Core\\\\Ajax\\\\AjaxResponse::create()" at /web/modules/custom/revslider/src/Controller/RevSliderAjax.php line 78.

This is the function with a code generation error:

protected function ajaxMediaHandle() {
    $action = RevSliderFunctions::getRequestVariable('action');
    switch ($action) {
      case 'delete_media':
        $fid = RevSliderFunctions::getRequestVariable('fid');

      case 'upload_media':
    $result = RevSliderMedia::getMedia();
    return AjaxResponse::create($result); // line 78


Please advise, thanks!


2 Answers 2


JsonResponse::create() was deprecated and is in the current Symfony version no longer available. It did not added any features other than that you need now an extra pair of brackets for daisy-chaining:

return (new AjaxResponse())->addCommand(new AlertCommand('Alert'));


I have been trying to resolve this issue and found the correct syntax to get the module up and running...

I have change the line 78 from

return AjaxResponse::create($result);


return new AjaxResponse($result);

And that fix my issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.