function drupal_json_output

cis7 common.inc drupal_json_output($var = NULL)
cle7 common.inc drupal_json_output($var = NULL)
elmsmedia7 common.inc drupal_json_output($var = NULL)
icor7 common.inc drupal_json_output($var = NULL)
meedjum_blog7 common.inc drupal_json_output($var = NULL)
mooc7 common.inc drupal_json_output($var = NULL)

Returns data in JSON format.

This function should be used for JavaScript callback functions returning data in JSON format. It sets the header for JavaScript output.

Parameters

$var: (optional) If set, the variable will be converted to JSON and output.

42 calls to drupal_json_output()
accessibility_content_load_tests_json in sites/all/modules/ulmus/accessibility/modules/accessibility_content/accessibility_content.inc
accessibility_tests_json in sites/all/modules/ulmus/accessibility/accessibility.pages.inc
Outputs settings and test information in JSON.
accessibility_test_page_view_json in sites/all/modules/ulmus/accessibility/accessibility.module
JSON render callback for accessibility test entities.
ckeditor_link_autocomplete in sites/all/modules/ulmus/ckeditor_link/ckeditor_link.module
context_ui_get_available_blocks in sites/all/modules/ulmus/context/context_ui/context_ui.module
Ajax callback to get the list of available blocks

... See full list

2 string references to 'drupal_json_output'
og-7.x-1.x.database.php in sites/all/modules/ulmus/og/tests/og-7.x-1.x.database.php
Filled installation of Drupal 7.0, for test purposes.
system_menu in modules/system/system.module
Implements hook_menu().

File

includes/common.inc, line 5041
Common functions that many Drupal modules will need to reference.

Code

function drupal_json_output($var = NULL) {
  // We are returning JSON, so tell the browser.
  drupal_add_http_header('Content-Type', 'application/json');

  if (isset($var)) {
    echo drupal_json_encode($var);
  }
}