How to reuse the same custom template in Ajax callback I am currently trying to display a list of nodes with a custom form containing taxonomy dropdowns (placed above node list) to filter out the contents. Now, on page load all content is displaying well by theming with custom template. Now my form is an Ajax form. After filtering I want to display the result with by using same template just passing the filter array of the node(s). Please find my ajax submit callback code.

Not working. render() works only if I pass nodes by loading node by viewMultiples. is there any way I can use similiar to theme() of drupal 7 like theme('my_content_build_page', $nodes)?

$nodes= Myclass::getNodesByEntityQuery($params);
$build = \Drupal::entityTypeManager()-&gt;getViewBuilder('node')-&gt;viewMultiple($nodes, 'full');
$response = new AjaxResponse();
$response-&gt;addCommand(
  new HtmlCommand(
    '.result_message', '&lt;div class="my_top_message"&gt;'.render($build).'&lt;/div&gt;'
  )
);
return $response;


On page load I am theming

$page_params['content'] = MyClass::getNodesByEntityQuery($params);

$build = [
  '#theme' =&gt; 'my_content_build_page',
  '#page_params' =&gt; $page_params,
];


Can I reuse the same template in Ajax Callback?
The replacement for theme() is a build array with a '#theme' key, as you already have for the page. 

In Drupal 8 pass this or the other build array from your question unrendered to an ajax html command, because render() in custom code should be avoided if possible:

$build = [
  '#type' =&gt; 'container',
  '#attributes' =&gt; [
    'class' =&gt; ['my_top_message'],
  ],
];

$build['content'] = \Drupal::entityTypeManager()
  -&gt;getViewBuilder('node')
  -&gt;viewMultiple($nodes, 'full');

$response = new AjaxResponse();
$response-&gt;addCommand(
  new HtmlCommand('.result_message', $build)
);
return $response;