This is really simple by using Drupal ajax framework.
First: Define, define your menu callback page:.
/**
* Implements hook_menu().
*/
function yourmodule_menu() {
$items = array();
$items['yourmodule/callback-page'] = array(
'title' => 'AJAX callback - refresh the elements on the right hand',
'page callback' => 'yourmodule_refresh',
'page arguments' => array(1),
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
/**
* Implements hook_menu().
*/
function yourmodule_menu() {
$items = array();
$items['yourmodule/callback-page'] = array(
'title' => 'AJAX callback - refresh the elements on the right hand',
'page callback' => 'yourmodule_refresh',
'page arguments' => array(1),
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
The second: DoSecondly, do ajax deliver on callback page.
/**
* Menu callback.
*/
function yourmodule_refresh($action, $type) {
if ($type != 'ajax') {
// This is js only.
return 'Oh well';
}
$content = t('What ever you want');
$commands = array();
$commands[] = ajax_command_replace('.right-hand-wrapper-class', $content);
$page = array('#type' => 'ajax', '#commands' => $commands);
ajax_deliver($page);
}
/**
* Menu callback.
*/
function yourmodule_refresh($action, $type) {
if ($type != 'ajax') {
// This is js only.
return 'Oh well';
}
$content = t('What ever you want');
$commands = array();
$commands[] = ajax_command_replace('.right-hand-wrapper-class', $content);
$page = array('#type' => 'ajax', '#commands' => $commands);
ajax_deliver($page);
}