JQuery로 Ajax에서 요청할 헤더를 추가하려고합니다. 다음은 Jquery Ajax에서 요청에 헤더를 추가하는 방법은 무엇입니까?
코드입니다 : -$.ajax({ type: "POST", contentType: "application/json", url: "http://localhost:8080/core-service/services/v1.0/patients/registerPatients", data: JSON.stringify(patientDTO), //crossDomain : true, dataType: 'json', headers: {"X-AUTH-TOKEN" : tokken}, success: function(patientDTO) { console.log("SUCCESS: ", patientDTO); /* location.href = "fieldagentHRA.html";*/ if (typeof(Storage) !== "undefined") { localStorage.setItem("patUrn", patientDTO.data); location.href="fieldagentHRA.html"; } }, error: function(e) { console.log("ERROR: ", e); display(e); }, done: function(e) { enableRegisterButton(true); } });나는 크롬이 검사 및 해당 헤더의 몸이 추가되지 않는 발견했다.
는 그럼 난 (Requestly 우리가 수동으로 요청에 헤더를 추가 할 수있는 크롬 + 파이어 폭스 플러그인은 ) Requestly을 사용했다.
수동 헤더를 추가 한 후 - 찍어 모두
헤더 X-인증 토큰은 "액세스 제어 요청 헤더"그러나 "X-AUTH 토큰"으로 존재 요청할 헤더 값과 함께 머리글은 첫 번째 그림에없는 두 번째 그림에 있습니다.
제 질문은 JQuery로 Ajax에서 요청 헤더를 추가하는 방법입니다.