I am displaying a Drupal Commerce node with AJAX add to cart functionality in a popup, with the Colorbox Node module. In my custom form callback, I have the following code.
// Form callback function
function ajax_module_form($form, &$form_state){
drupal_add_js(drupal_get_path('module','colorbox' . '/colorbox.js'));
$commands = array();
$commands[] = ajax_command_invoke('colorbox-node', 'colorbox.close');
return array('#type' => 'ajax', '#commands' => $commands);
}
I am trying to use Drupal's ajax_command_invoke to close the Colorbox window after AJAX form submission is complete, but cant seem get it to work. I tried 'parent.colorbox.close' as well but doesnt seem to work. The colorbox link has iframe and sample link is -
example.com/node/45434345?width=500&height=500&iframe=true and link class is .colorbox-node
Also the Colorbox module setting - invoke on all pages is also active.
Any lead/help is greatly appreciated.