나의 발자취
[fetch API] 본문
<!doctype html>
<html>
<body>
<input type = "button" value="fetch" onclick="
/*
fetch('css').then(function(response){
response.text().then(function(text){
alert(text);
})
}) */
//Asynchronous
function callbackname(){
console.log('response end');
}
fetch('html').then(callbackname);
console.log(1);
">
</body>
</html>
/*fetch('javascript') -> javascript를 가져오라고 서버에 요청한다.
'앱 개발 > etc' 카테고리의 다른 글
| [JS] 함수 기능 사용, 객체 넘겨받기 (0) | 2020.11.12 |
|---|---|
| [JS] 반복문을 이용해 태그의 색상 일괄 변경 (0) | 2020.11.12 |
| [JS] 기본문법, 리팩토링: this., var target 변수설정으로 중복 제거 (0) | 2020.11.12 |
| [JS] event 속성 / document.write() 은 print()와 같음 (0) | 2020.11.12 |
Comments