3

I need to create a page which is completely empty (no HTML returned at all). I need this for a POST callback (when using jEditable). I would like to still have access to the global variables (such as $user) and the modules that I have installed as I have a module installed which lets me access my REST service.

However, even though there should be not HTML returned per default, I should be able to return a string.

Does anyone know of a way to do this?

1 Answer 1

12

You can do that through a custom module - create a path and instead of returning the output, just print it.

Here's an example:

/**
 * Implements hook_menu().
 */
function YOURMODULE_menu() {
  $items = array();
  $items['custom-url'] = array(
    'page callback' => 'YOURMODULE_blank_page_callback',
    'page arguments' => array(),
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  );
  return $items;
}

/**
 * Display the content for your blank page.
 */
function YOURMODULE_blank_page_callback() {
  print 'Your string.';
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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