CakePHP ajax post keeps returning 400 Bad Request

前端 未结 4 597
北海茫月
北海茫月 2021-02-09 19:41

I am tring to use an ajax post to an action. GET requests work fine but when I try to POST I see a \'400 Bad Request\' in firebug and the view return a \'Black hole\' response.<

4条回答
  •  无人共我
    2021-02-09 19:49

    FYI CakePHP 2.3 and above now includes unlockedActions just for this purpose to be used in beforeFilter in your controller, or AppController.

    $this->Security->unlockedActions = array('ajaxAction');
    

    From: http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#disabling-security-component-for-specific-actions

提交回复
热议问题