AJAX form blocks getting internal server error I am trying to add a subscribe button as a block. 

I added a form as 

class SubscribeTag extends FormBase {

  public function buildForm(array $form, FormStateInterface $form_state) {

    $form['actions'] = [
      '#type' =&gt; 'actions',
    ];    

    $form['actions']['ajaxsubmit'] = [
      '#type' =&gt; 'submit',
      '#value' =&gt; 'Subsscribe',
      '#ajax' =&gt; [
        'callback' =&gt; '::ajaxSubmit',
        'wrapper' =&gt; 'message-wrapper',
      ],
    ];

    $form['messages'] = [
      '#type' =&gt; 'container',
      '#attributes' =&gt; ['id' =&gt; 'message-wrapper'],
    ];

    return $form;
  }

  public function getFormId() {
    return 'skb_subscription';
  }

  public function submitForm(array &amp;$form, FormStateInterface $form_state) {

  }

  public function ajaxSubmit(array &amp;$form, FormStateInterface $form_state) {
    drupal_set_message('Thank you for subscribing');
  }

}


It works correctly when a route is defined. When i go to the page /skb_subscribe_form the callback works correctly.  

skb_subscription.subscribe:
  path: 'skb_subscribe_form'
  defaults:
    _form:  '\Drupal\skb_subscription\Form\SubscribeTag'
    _title: 'SKB Subscription'
  requirements:
    _permission: 'access content'


But when i try add the form to a block using the code 

class SubscribeBlock extends BlockBase {
  public function build() {
    return \Drupal::formBuilder()-&gt;getForm("\Drupal\skb_subscription\Form\SubscribeTag");
  }
}


i get the following error "A fatal error occurred: The specified #ajax callback is empty or not callable."

I tried changing the callback with 

$form['actions']['ajaxsubmit'] = [
      '#type' =&gt; 'submit',
      '#value' =&gt; 'Subsscribe',
      '#ajax' =&gt; [
        'callback' =&gt; '\Drupal\skb_subscription\Form\SubscribeTag::ajaxSubmit ',
        'wrapper' =&gt; 'message-wrapper',
      ],
    ];


but still getting the same error.
Try this 

$build['form'] = \Drupal::formBuilder()-&gt;getForm('\Drupal\skb_subscription\Fo‌​rm\SubscribeTag');
 return $build;