I want to display some content, returned from an AJAX call in an overlay or popup.
Do you have any idea on how I can do it?
If your are using Drupal 7 you could make a use of the administrative overlay with a custom module.
You will need 3 hooks in your CUSTOM_MODULE_NAME_HERE.module file :
/**
* Implements hook_menu().
*/
function CUSTOM_MODULE_NAME_HERE_menu() {
$items = array();
$items['your/path/to/your/page'] = array(
'page callback' => 'CUSTOM_MODULE_NAME_HERE_page',
'access arguments' => array('access content'),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
/**
* Implements hook_admin_paths_alter().
*/
function CUSTOM_MODULE_NAME_HERE_admin_paths_alter(&$paths) {
$paths['your/path/to/your/page'] = TRUE;
}
/**
* page callback
*/
function CUSTOM_MODULE_NAME_HERE_page(){
$output = 'your page content';
return $output;
}
Along the lines of ipwa's response above, the overlay paths module is simple and easy to use for this type of thing.
The easiest way is to implement a simple custom module that does the following:
If you prefer, you can always have your hook menu return the content in JSON form, using drupal_json() and add it as inline html to the lightbox, instead of referencing an external file.
A very easy way to do this from Display node as a popup window: There are a lot of solutions for this kind of stuff. I would do it in the theme layer to have something really light. You can also use the variety of popup modules for this. One simple way to do this, is use the Lightbox2 module, checkout this documentation page: http://drupal.org/node/252260
To show a whole page content in a overlay(popup), use overlay_path module.
Install the module and in configuration u include the url of the page you need to show as an overlay(popup).
you can use some simple jquery and css as mentioned here and load an external page by ajax.
Simple dialog module can be useful, it's easy to implement a link to your popup page