X-Requested-With header not set in jquery ajaxForm plugin

后端 未结 5 1617
余生分开走
余生分开走 2020-12-05 19:32

I\'m using the jQuery ajaxForms plugin to make an ajax submit to my CakePHP app.

Cake\'s RequestHandler detects ajax requests by looking at the \"X-Requested-With\

5条回答
  •  感情败类
    2020-12-05 20:35

    Going from petersendidit's comment, I went searching for ajax/file upload questions.

    there's an interesting question on it on SO stating it is not possible, only through a hack with an iFrame. So no actual ajax call is made...

    since my form is a multipart with a file upload, the plugin uses the iFrametechnique instead of the regular ajax call...

    To solve this to know this should resemble an ajax call i'll add a hidden input field on the multipart forms...

提交回复
热议问题