How do I create an ajax link? I want to create an ajax linking a view (front page, for example).
I create an ajax edit link to edit content directely in the node. I success to add a link but when i click to it, a popin was opened(to edit content). 
I know how to make it in Drupal 7, but I don't find the solution for Drupal 8.

This is the code I am using.

    $build['ajax_edit_link'] = array(
    '#theme' =&gt; 'links',
    '#weight' =&gt; -2,
    '#links' =&gt; array(
      'ajax_edit_link' =&gt; array(
        'title' =&gt; t('Edit'),
        'url' =&gt; $entity-&gt;urlInfo('edit-form'),
        'attributes' =&gt; array(
          'class' =&gt; array('use-ajax'),
          'data-dialog-type' =&gt; 'dialog',
          'data-dialog-options' =&gt; Json::encode(array(
            'width' =&gt; 1200,
            'height' =&gt; 500,
          ))
        ),
      ),
    ),
  );


Here is all captures of the result of this edit ajax link in Drupal 8 (popin).







And here are the capture I want to make in Drupal 8 (Capture in Drupal 7 site).
Your code is missing one part that I can see, the #attached key:

  $build['ajax_edit_link'] = array(
    '#theme' =&gt; 'links',
    '#weight' =&gt; -2,
    '#links' =&gt; array(
      'ajax_edit_link' =&gt; array(
        'title' =&gt; t('Edit'),
        'url' =&gt; $entity-&gt;urlInfo('edit-form'),
        'attributes' =&gt; array(
          'class' =&gt; array('use-ajax'),
          'data-dialog-type' =&gt; 'dialog'
          'data-dialog-options' =&gt; Json::encode(array(
            'width' =&gt; 1200,
            'height' =&gt; 500,
          ))
        ),
      ),
    ),
    '#attached' =&gt; array('library' =&gt; array('core/drupal.ajax')),
  );