Form submission with AJAX to override a block content
Remove the data table from the block

public function build() {
    $filterForm = \Drupal::formBuilder()-&gt;getForm('Drupal\smeno\Form\FilterForm');

    $renderArray['filterform'] = $filterForm;

    return [
       '#theme' =&gt; 'Remboursement-sur-compte',
       '#McRefund_build_data' =&gt; $renderArray,
    ];
}


and add it to the form (placed in a wrapper):

  $form['McRefund_data'] = [
    '#type' =&gt; 'container',
    '#attributes' =&gt; ['id' =&gt; 'table-wrapper'],
    'table' =&gt; $this-&gt;getMcRefund(),
  ];


Attach this ajax callback to a form element

          '#ajax' =&gt; [
            'event' =&gt; 'click',
            'callback' =&gt; '::updateTable',
            'wrapper' =&gt; 'table-wrapper',
            'progress' =&gt; [
              'type' =&gt; 'throbber',
              'message' =&gt; t('Verifying entry...'),
            ],
          ],


and replace the table in the ajax callback:

  public function updateTable(array $form, FormStateInterface $form_state) {
    return $form['McRefund_data'];
  }