Project

General

Profile

Feature #20952 » 11819_v2.diff

Administrator Admin, 2009-09-16 16:33

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">
/*<![CDATA[*/
response = ' . json_encode($this->content) . ';
/*]]>*/
</script>';
header('Content-type: text/html; charset=' . $this->charset);
echo $content;
}
}
(2-2/2)