I am frustrated. I'm unable to add an ajax route in Magento 2.2 no matter what I try, I get a 404.
routes.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="admin">
<route id="schematics" frontName="schematics">
<module name="Schematics" before="Magento_Adminhtml" />
</route>
<route frontName="schematics_ajax" id="schematics_ajax">
<module name="Schematics" before="Magento_Adminhtml"/>
</route>
</router>
</config>
The Controller is beside working controllers at [module path]/Controller/Adminhtml/Ajax/Index.php and looks something like this:
//namespace is defined here.
class Index extends \Magento\Backend\App\Action
{
protected $resultPageFactory;
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory
) {
die('foo');
}
public function execute()
{
die('foo');
}
}
/admin/schematics_ajax/index shows a 404
I'm pretty sure I followed https://devdocs.magento.com/guides/v2.2/extension-dev-guide/routing.html pretty much exactly. What am I missing?
/admin/schematics_ajax/ajax