jQuery POST to CakePHP $this->data

旧巷老猫 提交于 2019-12-06 02:55:26

$this->data expects your variable names to be in the form

data[Model][Property]

For your example change dataString to data['ModelName']['test']=test data

and it should work.

It could be that the controller's data attribute is only prefilled when the POST data conforms to an existing model attribute, like when data is POSTed via the form helper. So you might have to send "Test.something=testdata", so that you can access $this->data["Test"]["something"] in the controller.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!