[问题] 请教ajax问题

楼主: ymps3502 (chaney)   2017-09-01 11:59:55
目前尝试用laravel + vue.js写网页
边看影片边学习
看到此处时有一些疑惑
https://youtu.be/2pCUxZZq68I?t=8m7s
影片处使用axios去发送request到后端
他说为了让laravel能分辨ajax request所以要加XMLHttpRequest到header
不过github上axios第一个features就是make XMLHttpRequests
外加我实际测试有无加header都可以从后端得到response
所以...XMLHttpRequest需要加到header吗?
作者: freeccc (自由的ccc)   2017-09-01 12:47:00
这个 header 是安全性考量用的,不是说没设定就拿不到资料,参考这里解说https://stackoverflow.com/questions/17478731/whats-the-point-of-the-x-requested-with-header短网址 https://goo.gl/4psHPY

Links booklink

Contact Us: admin [ a t ] ucptt.com