Ajax原生 2018-11-08

// 简单的ajax原生实现

var url = 'https://hq.tigerbrokers.com/fundamental/finance_calendar/getType/2017-02-26/2017-06-10';

var result;

var XHR = new XMLHttpRequest();

XHR.open('GET', url, true);

XHR.send();

XHR.onreadystatechange = function() {

    if (XHR.readyState == 4 && XHR.status == 200) {

        result = XHR.response;

        console.log(result);

    }

}

你可能感兴趣的:(Ajax原生 2018-11-08)