Rhetoric question: Automatically basing on... what ?
Standard page num in TYPO3 is 0 and it's also by default used in all linking ViewHelpers, if you want to use something else you need to write it exactly in the view (pageType="12345"
) or, for an instance configure it in your setup.txt file in your extension:
plugin.tx_yourextension.settings.ajaxPageType = 12345
So you can use it in your view like:
<f:link.action pageType="{settings.ajaxPageType}">
Disadvantage of this approach is that you need to repeat this pageNum in settings and also in plugin's bootstrap, anyway that's better then checking everytime which number exactly is this.
TIP: Don't forget to flush system cache to take setup.txt changes into account.
P.S.
Of course I assume that you're bootstrapping your ajax actions like ie:
yourAjaxAction = PAGE
yourAjaxAction {
typeNum = 12345
10 = USER
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = YourExtension
pluginName = YourFePluginRegisteredProperly
vendorName = VENDOR_NAME
}
config {
disableAllHeaderCode = 1
xhtml_cleaning = 0
admPanel = 0
debug = 0
no_cache = 1
}
}
If you do - you don't need to use f:link.action
VH, if you don't... you should start :)