이번에는 npm이 아닌 cdn으로 설치해보자. 차기 프로젝트가 nodejs를 지원하지 않는 탓이다.
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
설치 끝.
axios({
method: "get", // 통신 방식
url: "www.naver.com", // 통신할 웹문서
headers: {'X-Requested-With': 'XMLHttpRequest'}
params: { api_key: "1234", langualge: "en" },
timeout: 1000
responseType: 'json', // default
}).then(function (response) {
// response Action
});
{
data: {},
status: 200,
statusText: 'OK',
headers: {},
config: {},
request: {}
}