看板 Ajax 關於我們 聯絡資訊
前提: 使用 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
j100002ben:header(X-Requested-With:XMLHttpRequest) 06/23 00:56
j100002ben:忘記加引號header('X-Requested-With:XMLHttpRequest') 06/23 00:56
evernever:B.php加header('X-Req')我也試過了, 但C.php還是看不到 06/23 07:42
kylekai:J然是 B header redirect 的..那就帶參數去給 c.php 判斷 06/23 14:00