1
我發送Ajax與beforeSend頭選項(添加授權令牌),其運行正常通話,但我可以看到在控制檯2名所列的請求......jQuery Ajax調用,爲什麼在網絡活動中列出兩個請求?
$.ajax('https://macMini.local:8000/Products', {
type: "GET",
cache: false,
async: false,
dataType: "json",
beforeSend: function (xhr, settings){
xhr.setRequestHeader('Authorization', 'Bearer ' + amplify.store("tokens").access_token);
}
})...
,並在開發瀏覽器控制檯,我見:
Request URL:https://macmini.local:8000/Products?_=1381768498131
Request Method:OPTIONS
Status Code:204 No Content
...
沒有響應 和
Request URL:https://macmini.local:8000/Products?_=1381768498131
Request Method:GET
Status Code:200 OK
...
與JSON響應
'async:false' === FAIL! – Alnitak