js 또는 jQuery를 사용하여 Ajax 요청에 커스텀 HTTP 헤더를 추가하려면 어떻게 해야 합니까? JavaScript 또는 jQuery를 사용하여 커스텀HTTP 헤더를 추가하거나 작성하는 방법을 알고 있는 사람이 있습니까?필요한 것에 따라 몇 가지 솔루션이 있습니다. 개별 요구에 커스텀헤더(또는 헤더세트)를 추가하려면headers속성: // Request with custom header $.ajax({ url: 'foo/bar', headers: { 'x-my-custom-header': 'some value' } }); 모든 요청에 기본 헤더(또는 헤더 세트)를 추가하려면$.ajaxSetup(): $.ajaxSetup({ headers: { 'x-my-custom-header': 'some v..