You are here

function ajax_out in Ajax 6

Outputs data

Parameters

$data String:

Return value

Exit

2 calls to ajax_out()
ajax_submitter in ./ajax.module
Submission handler callback
ajax_validator in ./ajax.module
Validation handler callback

File

./ajax.module, line 461

Code

function ajax_out($data) {
  $buffer_len = ob_get_length();
  if ($buffer_len !== FALSE && $buffer_len > 0) {
    ob_clean();
  }
  header('HTTP/1.1 200 OK', TRUE);
  if (!array_key_exists('HTTP_X_REQUESTED_WITH', $_SERVER) && $_SERVER['HTTP_X_REQUESTED_WITH'] !== 'XMLHttpRequest') {
    drupal_set_header('Content-Type: text/html; Charset=UTF-8');
    print "<textarea>";
    print drupal_to_js($data);
    print "</textarea>\n";
  }
  else {
    drupal_set_header('Content-Type: text/javascript; Charset=UTF-8');
    print drupal_to_js($data);
  }
  exit;
}