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();
載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。