26 August 2016

How to validate AJAX requests in Zend Framework. There is a function in request class, to use instead of comparing the $_SERVER['HTTP_X_REQUESTED_WITH'] directly. This can be beneficial for security, so you can validate that the request is ajax request.

Source code viewer
  1. public function myAction() {
  2. if ($this->getRequest()->isXmlHttpRequest()) {
  3. // Code run during AJAX request...
  4. }
  5. }
Programming Language: PHP