0
我使用XMLHttpRequest将文件发送到后端,并将返回json格式信息,我如何获取每个值?Angular2读取json使用XMLHttpRequest.response
代码
this.resdata = xhr.response;
console.log("this.resdata2: " + this.resdata);
console.log("this.resdata[0]: " + this.resdata[0]);
console.log("this.resdata[1]: " + this.resdata[1]);
和Chrome DevTools消息
this.resdata2: {"result":123,"gpsvalue":246}
home.component.ts:112 this.resdata[0]: {
home.component.ts:113 this.resdata[1]: "
我如何获得resdata2结果和gpsvalue的价值,并显示我的网页上?
节目属性“gpsvalue”不会对类型“数字”和属性“结果”存在不上型存在'数'? – KenChen
谢谢你的帮助,问题解决了 – KenChen