Codeigniter ajax CSRF problem

前端 未结 7 2118
醉话见心
醉话见心 2020-11-27 06:08

I\'ve made a simple autoload function that loads content when you scroll down on a website. However, there seems to be a few problems when i enable CSRF protection in Codeig

7条回答
  •  轮回少年
    2020-11-27 06:34

    If you want, you can echo both the token name and the hash somewhere appropriate. Something like this.

     echo $this->security->get_csrf_token_name()
    

    and

     echo $this->security->get_csrf_hash()
    

    Or, you could use form_open() as usual and use the hidden input that is generated for you from your javascript. Disabling the CSRF-functionality is the wrong way to go.

提交回复
热议问题