Yii 2.0 ajax request CSRF validate fail

When setting ajax request in Yii 2.0 framework, always get 400 error "Unable to verify your data submission.", found the problem is csrf cookies not set correct by test, this topic will show how to fix it.
2011-11-04 15:22:45 0 Comments HTTP Boy.Lee

cookies is not working

if you have problem with cookies, try the follow debug steps
2011-11-04 15:20:48 0 Comments HTTP Boy.Lee

max length for cookies

Do you know the max length of Cookies?

Cookies in Yii 1.0

Control Cookies in Yii 1.0 Framework