I have an action that’s meant to be accessed only through ajax. How can I make it give blank output when someone visits the url directly as http://site.com/controller/action? Is there a way that Zend can tell if it’s an ajax call or direct url visit?
Edit: I found out about Zend’s $this->getRequest()->isXmlHttpRequest(), but I wonder if this can be trusted enough?
There’s no way of reliably telling an AJAX request and any other kind of request apart, so no you can’t block non-AJAX access.