Ajax request via dedicated page type
Because there are so many old pages floating around on this internet with a now faulty example of how to handle ajax requests via a dedicated page type in TYPO3 and I stumbled across it again today as part of a code refactoring, I want to do my part help dispel the assumption that the associated PAGE object needs to be mishandled via config.no_cache = 1. Because it doesn't have to. And it shouldn't either, because if you look at your log, you'll see a lot of warnings like "$TSFE->set_no_cache() was triggered. Reason: config.no_cache is set. Caching is disabled!".
And we don't want that. It is sufficient to integrate the content of the page as COA_INT or USER_INT. Because these objects are definitely not cached!
ajaxPage = PAGE
ajaxPage {
typeNum = 123456789
config {
disableAllHeaderCode = 1
admPanel = 0
debug = 0
}
10 = COA_INT
10 < plugin.tx_extensionname_pluginname
}Or also with a different version
ajaxPage = PAGE
ajaxPage {
typeNum = 123456789
config {
disableAllHeaderCode = 1
admPanel = 0
debug = 0
}
10 = USER_INT
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = ExtensionName
pluginName = PluginName
vendorName = VendorName
controller = ControllerName
action = ajax
}
}Comments
No Comments