ajax callback on form element checkboxes
When you use a callback $forms and $form_state is available for use in your callback. But you should call them as parameters in your callback definition.
So:

public function ajax_option_callback(array $form, FormStateInterface $form_state) {
  // get the id of the form
  $value = $form_state-&gt;getFormObject()-&gt;getFormId();
  // create a response object and return it
}

public function ajax_option_callback() {
  // $form and $form_state not available
}


Note that &amp;form_state-&gt;getTriggeringElement() contains nothing as the form is not submitted.

I realize now the question is for D7. Maybe my answer is usefull for someone within the D8 context.