ajax 에 authorization bearer 추가하는 방법
| // ajax
$.ajax({
    url: 'YourRestEndPoint',
    headers: {
        'Authorization': `Bearer ${token}`,
    },
    method: 'POST',
    data: YourData,
    success: function(data){
      console.log('succes: '+data);
    }
  });
// axios
axios({
  method: 'post',
  url: yourEndpoint,
  data: yourData,
  headers: { 'authorization': `Bearer ${token}` }  });  | 
[링크 : https://www.freecodecamp.org/.../which-ajax-should-i-use-for-post-i-need-to-add-a-bearer-token/.../2]
'Programming > web 관련' 카테고리의 다른 글
| css position (0) | 2019.03.28 | 
|---|---|
| webpack (0) | 2019.02.20 | 
| webGL vs SVG (0) | 2019.01.07 | 
| w3c validator (0) | 2018.12.10 | 
| 미세먼지 크롤러 (다음, 네이버) (0) | 2018.12.07 | 
