Skip to content

Instantly share code, notes, and snippets.

@fidelix
Created March 19, 2015 13:13
Show Gist options
  • Save fidelix/0e380ee444963382a631 to your computer and use it in GitHub Desktop.
Save fidelix/0e380ee444963382a631 to your computer and use it in GitHub Desktop.
function custom_ajaxcallback($type = 'ajax') {
if($type == 'ajax') {
$output = t('Hello World!');
$command = array();
$commands[] = ajax_command_append('#sayinghello', $output);
$page = array('#type' => 'ajax', '#commands' => $commands); --> In this line
ajax_deliver($page);
}
else{
return t("Hello world in new page.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment