[問題] jQuery 網址導向沒送 X-Requested-With

看板Ajax作者 (NeverEver)時間15年前 (2010/06/22 12:25), 編輯推噓2(202)
留言4則, 3人參與, 最新討論串1/1
前提: 使用 jQuery ajax call 時, jQuery 固定會送一個 Http header X-Requested-With : XMLHttpRequest 小弟的 PHP 頁面會隨著這個重要的 header 而回傳 1) 全部內容 (direct access) 或 2) 部分內容 (ajax call) 問題: 現在我有個 A.php, 用 ajax call 了 B.php, 但 B 只是個中間人 做了一些內部處理後, 導向 C.php, 呈現該有的內容 但現在 C 看不到 jQuery 的 header 所以判定是 direct access 一直回傳全部內容...(汗 jQuery 有辦法做第二次網址導向時繼續送出 X-Requested-With 嗎? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 124.168.137.213

06/23 00:56, , 1F
header(X-Requested-With:XMLHttpRequest)
06/23 00:56, 1F

06/23 00:56, , 2F
忘記加引號header('X-Requested-With:XMLHttpRequest')
06/23 00:56, 2F

06/23 07:42, , 3F
B.php加header('X-Req')我也試過了, 但C.php還是看不到
06/23 07:42, 3F

06/23 14:00, , 4F
J然是 B header redirect 的..那就帶參數去給 c.php 判斷
06/23 14:00, 4F
文章代碼(AID): #1C83ieWW (Ajax)
文章代碼(AID): #1C83ieWW (Ajax)