728x90 Fetch1 [Javascript] fetch API Javascript Web에서 리소스의 비동기 처리 - fetch API fetch는 promise 기반으로 비동기 네트워크 통신을 알기쉽게 기술하는 방법이다. fetch로부터 반환되는 promise객체는 Error발생시 reject하지않고, resolve를 통해 전달된 response내의 .status를 통하여 네트워크 상태를 진단할수 있다. (ex 200 성공 404 실패 데이터없음 등.) fetch('경로 또는 url') .then(response => response.json() or response.text()) .then(data => console.log(data)); 2021. 2. 25. 이전 1 다음 728x90