How to get “Data” field from xhr.responseText?

后端 未结 7 1058
别跟我提以往
别跟我提以往 2020-12-09 14:40

I have XMLHttpRequest() function given below

var searchFriendRequests = function (userid) {
    var xhr = new XMLHttpRequest();
    xhr.open(\'G         


        
7条回答
  •  一整个雨季
    2020-12-09 15:27

    You first need to parse responseText in JSON, for this you should use JSON.parse(). Then you can access it using key.

    var json = JSON.parse(xhr.responseText);
    var yourData = json.Data; // or json["Data"]
    

提交回复
热议问题