I need Full Action Name in Ajax Controller Magento 2.
protected $request;
public function __construct(
...
\Magento\Framework\App\Request\Http $request
) {
$this->request = $request;
}
$action = $this->request->getFullActionName();
This always giving me my ajax controller full action name.
I need, suppose if I m on the product page this should give me "catalog_product_view".
If I m on search this should display "catalogsearch_result_index".
Please help.
$this->getRequest()->getFullActionName()
or use\Magento\Framework\App\RequestInterface
instead of\Magento\Framework\App\Request\Http