Drupal 7 #ajax callback on form submit Hello I have created a custom form added a # ajax callback on form submit

    $form['hotel_book_form']['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Check Availability'),
    '#ajax' =&gt; array(
      'callback' =&gt; "list_rooms",
      'wrapper' =&gt; "replace_hotelbook_div",
      'method' =&gt; 'replace',
      'effect' =&gt; 'fade',
    ),
  );


and I have added this wrapper as suffix to the form

    $form['hotel_book_form'] = array(
    '#type' =&gt; 'fieldset',
    '#title' =&gt; t('Book Hotel'),
    '#weight' =&gt; 5,
    '#collapsible' =&gt; TRUE,
    '#collapsed' =&gt; FALSE,
    '#prefix' =&gt; '&lt;div id="replace_hotelbook_div"&gt;&lt;/div&gt;',
  );


but when I click on form's submit button the page gets simply reloaded and the ajax callback function does not fire.
You haven't actually wrapped the element, you've inserted an empty &lt;div&gt; immediately before it.

You need to use #prefix and #suffix to wrap an element in HTML:

...
'#prefix' =&gt; '&lt;div id="replace_hotelbook_div"&gt;',
'#suffix' =&gt; '&lt;/div&gt;'