18

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?

8

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;
}
5

Along the lines of ipwa's response above, the overlay paths module is simple and easy to use for this type of thing.

3

The easiest way is to implement a simple custom module that does the following:

  • Implement hook_menu() and defines a custom page callback
  • Return the content you want in your page callback
  • Include your favourite jQuery lightbox plugin (either via a Drupal module or by hand)
  • Add a custom javascript file via drupal_add_js()
  • In your custom javascript file, bind the event of your choice and make the lightbox plugin load external content from the URL in your hook_menu()

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.

2

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

2

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).

0

you can use some simple jquery and css as mentioned here and load an external page by ajax.

  • hey buddy, Thanks for your reply.. But i have already tried with this..But having some issues.. So i am searching for some other alternative..!! – Sameer May 5 '11 at 10:48
  • 1
    The right way of doing this is by utilizing the core Overlay APIs if available. – Sivaji May 5 '11 at 15:39
  • I totally agree with Bart. Maybe this site has moved here: jquerytools.org/documentation/overlay. – Sk8erPeter Nov 27 '12 at 19:55
0

Simple dialog module can be useful, it's easy to implement a link to your popup page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.