That means the request method is ajax or not .(Yaf >=1.0.0)
Yaf_Request_Abstract::isXmlHttpRequest — Determine if the request is an Ajax request
Checks whether the request is an Ajax request by inspecting the HTTP_X_REQUESTED_WITH request header.
Note:
Yaf_Request_Simple overrides this method and always returns
false, since command-line requests are never Ajax requests.
This function has no parameters.
Returns true if the request is an Ajax request (the X-Requested-With header equals XMLHttpRequest), false otherwise.
Example #1 Yaf_Request_Abstract::isXmlHttpRequest() example
<?php
class ProductController extends Yaf_Controller_Abstract
{
public function viewAction()
{
// Assuming the request carries "X-Requested-With: XMLHttpRequest"
if ($this->getRequest()->isXmlHttpRequest()) {
$this->getResponse()
->setHeader("Content-Type", "application/json")
->setBody(json_encode(["id" => 17, "name" => "Yaf in Action"]));
return false;
}
}
}
?>The above example will output something similar to:
{"id":17,"name":"Yaf in Action"}