앱 개발/etc

[fetch API]

달모드 2020. 11. 19. 18:36
<!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를 가져오라고 서버에 요청한다.