[Flow] How to determine if request ist Ajax request?
Christian Jul Jensen
julle at typo3.org
Thu Sep 12 10:40:46 CEST 2013
Hi Christian
On 12. sep. 09.15, Christian Loock wrote:
> it there a quick way in a action controller to determine if a request
> uses Ajax?
It is a convention to set the Http-header X-Requested-With to
XMLHttpRequest when doing ajax calls. Most javascript frameworks does
that automatically for you.
So in a Flow controller you can do something like this
if($this->request->getHttpRequest()->getHeader('X-Requested-With') ==
'XMLHttpRequest') {}
--
Christian Jul Jensen
julle at typo3.org
TYPO3 - Inspiring people to share!
http://typo3.org
More information about the Flow
mailing list