I’ve created a view, manually, which is a dashboard and am using a costum layout in which I inserted
<?= Html::csrfMetaTags() ?>
in the head section.
Yet, when the view is accessed, I keep getting bombarded with errors in the log relating to
[error][yii\web\HttpException:400] yii\web\BadRequestHttpException: Unable to verify your data submission. in D:\home\site\vendor\yiisoft\yii2\web\Controller.php:166
The index itself is a series of DIVs and I use a JS interval to continuously run AJAX calls to get stats and push them to their respective DIVs.
I created a custom layout (views\layouts\dashboard-finance.php) and in that layout I’ve include the <?= Html::csrfMetaTags() ?> in the head section. When the index is rendered the following appears:
In my index, it performs an AJAX call to the actionGetOrdersCount action and gets the result but also generate the ‘BadRequestHttpException: Unable to verify your data submission.’ error?
I was under the impression that by including the <?= Html::csrfMetaTags() ?> in the layout, that the token was automatically handled with any requests.