How to close the overlay after form submission In order to be able to quickly edit Fullcalendar items, I altered the node edit form of the specific content type so the events are saved with AJAX and the page doesn't have to reload.

However, I don't know how to close the overlay afterwards. I found overlay_close_dialog(), but how do I implement this in my functions (I'm very new to Drupal coding)?

Until now I have:

&lt;?php
/**
* Implements hook_form().
*/
function fullcalendar_ajax_node_save_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if( $form_id == 'agenda_item_node_form') {
     $form['actions']['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Add to Apple Form'),
    '#weight' =&gt; 50,
      '#ajax' =&gt; array(
        'wrapper' =&gt; 'agenda-item-node-form',
        'callback' =&gt; 'fullcalendar_ajax_node_save_callback',
        'effect' =&gt; 'fade'
        ),
    '#submit' =&gt; 
      array (
        0 =&gt; 'node_form_submit',
      ),
    );
  }
  return $form;
}

function fullcalendar_ajax_node_save_callback($form, &amp;$form_state) {
  $form_state['rebuild'] = TRUE;
  return $form;
}
?&gt;
The callback should be: 

function fullcalendar_ajax_node_save_callback(&amp;$form, &amp;$form_state) {
  // Could check that the overlay is open? Part of core, so overkill
  if (module_exists('overlay') &amp;&amp; overlay_get_mode() == 'child') {
     $current_path = current_path();
     overlay_close_dialog($current_path, 
        array('query' =&gt; drupal_get_query_parameters(NULL, array('q', 'render'))));
    $form_state['redirect'] = FALSE;
  }
}


See overlay.module, about line 148 function overlay_init() for an example in core that uses as much drupal API as possible.