How to load content in a div with ajax?
I've come up with a working solution. It might not be the best approach but it works.

You need to create your routing file:

my_module.routing.yml

diocese_core.path_with_data:
  path: 'path-with-data'
  defaults:
    _controller: '\Drupal\my_module\Controller\MyController::Render'
  requirements:
    _access: 'TRUE'


Creating the controller for your page

src/Controller/MyController.php

&lt;?php

namespace Drupal\my_module\Controller;

use Drupal\Core\Controller\ControllerBase;
use \Symfony\Component\HttpFoundation\Response;

/**
 * An example controller.
 */
class MyController extends ControllerBase {

  /**
   * {@inheritdoc}
   */
  public function Render() {
    $build = array(
      '#type' =&gt; 'markup',
      '#markup' =&gt; t('Hello World!'),
    );
    // This is the important part, because will render only the TWIG template.
    return new Response(render($build));
  }

}


And you only need to call in javascript

jQuery('#my-div').load('path-with-data');


An this will be the output once the code is executed:

&lt;div id="my-div"&gt;Hello World!&lt;/div&gt;


References:


Drupal 8 module - How to use AJAX?
Drupal8:Basic Jquery Ajax custom module controller