I try to create controller that handles ajax requests.
I found out, that I have to add this to my TS config:
ajaxCall = PAGE
ajaxCall {
typeNum = 999
config.disableAllHeaderCode = 1
config.metaCharset = UTF-8
xhtml_cleaning = 0
admPanel = 0
10 = COA
10 < tt_content.list.20.registration_userregistration
}
And my controller looks like this:
/**
* JSONController
*/
class JSONController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
/**
* @var string
*/
protected $defaultViewObjectName = 'TYPO3\\CMS\\Extbase\\Mvc\\View\\JsonView';
/**
* action test
*
* @return string
*/
public function testAction() {
$this->view->assign('value', "001");
}
}
This works, I get a blank page with "001" on it. But if I look at the source, there are 4 empty lines, and "001" is in the 5th line.
-empty-
-empty-
-empty-
-empty-
"001"
I have no idea why...