406 error on ajax calls in Drupal 8 Yesterday I upgraded from drupal 8 beta 3 to beta 10. I noticed all my ajax calls are now getting error 406 (Not acceptable). 

This is my route:

switch_customer.user:
  path: '/profile/get/{template}'
  defaults:
    _controller: 'Drupal\switch_customer\Controller\CustomerController::renderDisplay'
    _title: 'User Info'
  requirements:
    _permission: 'access content'


Controller:

$content = array(
            '#theme' =&gt; $templateName,
            '#items' =&gt; $items
        );

        $content = render($content);
        return $content;


Ajax call:

    jQuery.ajax({
        type: "GET",
        url: '/profile/get/info',
        success: function (data) {
           jQuery(".profile-sidebar-info").empty().append(data);
            if(cb){
                cb();
            }
        }
    });


I can't figure out what I'm doing wrong? All my calls were fine in the previous beta. Can someone assist me?

Thanks!
Your controller must return an array or a Response object.

If you want to return the content as-is (no "drupal" around it):

return new Response($content)


If you want to return a normal, full page, then just return the render array.