How to call Ajax callback on form submit to display results I want to get results, after validating and add fields as well in result like i want to add checkbox in result 

function afaf_custom_form($form, &amp;$form_state) {
  $form = array();

  $form['d_id'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; t('D id'),
    '#size' =&gt; 60,
    '#maxlength' =&gt; 60,
    '#required' =&gt; TRUE,

  );

  $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Search'),
    '#ajax' =&gt; array(
     'callback' =&gt; 'v_custom_ajax_handler',
     'wrapper' =&gt; 'display-dept-ajax',
     'method' =&gt; 'replace',
     'effect' =&gt; 'fade',
   ),
  );
$form["prefix"] = array(
    "#markup" =&gt; "&lt;div id='display-dept-ajax'&gt;&lt;/div&gt;");
$form["suffix"] = array(
    "#markup" =&gt; "&lt;/div&gt;");



  return $form;
}



function v_custom_ajax_handler($form, &amp;$form_state) {

  if (!empty($form_state['input']['d_id'])) {

  $form["department name"] = array(
    "#markup" =&gt; "&lt;div id='display-dept-ajax'&gt;Department Id : ""&lt;/div&gt;

");


  return  $form["department name"];
  }
}
Basic working code example for validation or submit form with ajax.

 function afaf_custom_form($form, &amp;$form_state) {
  $form['d_id'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; t('D id'),
    '#size' =&gt; 60,
    '#maxlength' =&gt; 60,
    '#required' =&gt; TRUE,

  );
  $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Search'),
    '#ajax' =&gt; array(
     'callback' =&gt; 'v_custom_ajax_handler',
     'wrapper' =&gt; 'display-dept-ajax',
   ),
  );

  $form['#prefix'] = '&lt;div id="display-dept-ajax"&gt;';
  $form['#suffix'] = '&lt;/div&gt;';
  if (isset($form_state['values'])) {
    $form['output'] = array('#markup' =&gt; 'thankyou message');
  }
  return $form;
}

function afaf_custom_form_submit($form, &amp;$form_state) {
  $form_state['rebuild'] = TRUE;
}

function v_custom_ajax_handler($form, $form_state) {
  $form_errors = form_get_errors();
  if ($form_errors) {
    return $form;
  }
  else {
    $thank_you_html = drupal_render($form['output']);
    $commands[] = ajax_command_insert(NULL, $thank_you_html);
    return array(
      '#type' =&gt; 'ajax',
      '#commands' =&gt; $commands,
    );
  }
}