function views_ajax_render

2.x ajax.inc views_ajax_render($output = NULL, $title = NULL, $url = NULL, $js = NULL)

Simple render function to make sure output is what we want.

This function renders an object into JSON, and that object contains commands to the ajax response parser on the other side. The actual commands that can be sent are completely dependent upon the client javascript parser, which can be anything, but this function assumes that 'display', at least, will be displayed in some kind of ajax spot or popup.

Related topics

16 calls to views_ajax_render()
views_ajax in includes/ajax.inc
Menu callback to load a view via AJAX.
views_ui_add_display in includes/admin.inc
AJAX callback to add a display.
views_ui_add_item_form in includes/admin.inc
Form to add_item items in the views UI.
views_ui_ajax_form in includes/admin.inc
Generic entry point to handle forms.
views_ui_analyze_view in includes/admin.inc
Page callback to display analysis information on a view.

... See full list

File

includes/ajax.inc, line 80
ajax.inc

Code

function views_ajax_render($output = NULL, $title = NULL, $url = NULL, $js = NULL) {
  if (empty($output)) {
    $output->display = t('Server reports invalid input error.');
    $output->title = t('Error');
  }
  elseif (!is_object($output)) {
    $temp = new stdClass();
    $temp->display = $output;
    $temp->title = $title;
    $temp->url = $url;
    $output = $temp;
  }
  if (!empty($js)) {
    $output->js = $js;
  }

  drupal_json($output);
  exit;
}