jquery傳送請求
$.ajax({
method: "POST",
headers: {
"Auth_xxx": "yes"
},
data: {},
url: "",
success: function (response) {
console.log("response data", response);
}
})
django request.META始終取不到值
request.META.get("HTTP_AUTH_XXX", "")
改正
# jquery發請求引數不要帶下劃線"_"
headers: {
"Auth_xxx": "yes"
},
# 修改為
headers: {
"Authxxx": "yes"
},
# request.META.get("HTTP_AUTHXXX", "")
前提是跨域部分要開啟