[問題] 請教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