Project

General

Profile

Feature #20952 » 11819.diff

Administrator Admin, 2009-08-28 22:35

View differences:

typo3/classes/class.typo3ajax.php (working copy)
* @return void
*/
public function setContentFormat($format) {
if (t3lib_div::inArray(array('plain', 'xml', 'json', 'jsonhead', 'jsonbody'), $format)) {
if (t3lib_div::inArray(array('plain', 'xml', 'json', 'jsonhead', 'jsonbody', 'javascript'), $format)) {
$this->contentFormat = $format;
}
}
......
case 'json':
$this->renderAsJSON();
break;
case 'javascript':
$this->renderAsJavascript();
break;
case 'xml':
$this->renderAsXML();
break;
......
echo $content;
}
}
/**
* Renders the AJAX call as inline JSON inside a script tag. This is useful
* when an iframe is used as the AJAX transport.
*
* @return void
*/
protected function renderAsJavascript() {
$content = '<script type="text/javascript">
response = ' . json_encode($this->content) . ';
</script>';
header('Content-type: text/html; charset=' . $this->charset);
echo $content;
}
}
(1-1/2)