P
P
pink2floyd2018-11-15 17:11:22
Yii
pink2floyd, 2018-11-15 17:11:22

Why does depDrop throw a 400 Bad Request error?

The depDrop widget throws a 400 error in the console.
Added <?= Html::csrfMetaTags() ?>
to layouts When disabling csrf in the controller, everything works fine, but disabling it is not the point. I have my own js with an ajax request, which also gave the same error, as soon as I started sending csrf from the meta tag to data, everything worked there, but now the question is how to send csrf to depDrop and why he himself does not beret.
It is also interesting that the widget worked before the transfer from windows to linux (but this is not accurate, I did not see it myself)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2018-11-15
@pink2floyd

Added <?= Html::csrfMetaTags() ?> to layouts

And what do you think it should give? If the widget (js that is in it) does not provide the logic to take the csrf token from the meta tags and add it to the post request as a parameter, then this will not work.
So the first thing to check is the request that flies away. Does it have srf. Probably not. Then either finish the js of the plugin (perhaps at the widget level in php you can solve this) or disable the protection.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question