Ajax 로드 방법

ajax 로드방법 1.

var ajax = new XMLHttpRequest();
    ajax.onreadyststechange = function(){
    if (this.readyState == 4 && this.status == 200) {
        console.log(ajax.responseText)
        }
};
ajax.open("GET", "url 정보", true);
ajax.send();

ajax 로드방법 2.

fetch('url 정보')
    .then((response) => {
       return response.json()
})
    .then((결과) => {
     console.log(결과)
})

CONTACT ME

Welcomes any questions you may have.