rkey

rkey

xhr发送请求-示例

关键代码:

var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
    if (xhr.readyState === 4 && xhr.status === 200) {
        var response = JSON.parse(xhr.responseText);
        console.log(response);
    }
};

xhr.open('GET', 'http://192.168.0.109:5000/json', true);
xhr.send();

------
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
    if (xhr.readyState === 4 && xhr.status === 200) {
        var response = JSON.parse(xhr.responseText);
        console.log(response[0].name);
    }
};
  
xhr.open('GET', 'http://192.168.0.109:5000/json', true);  
xhr.send();
加载中...
此文章数据所有权由区块链加密技术和智能合约保障仅归创作者所有。