jquery getJSON获取值

时间:2016-05-20 12:11:02

标签: javascript jquery json getjson

我试图从json获得价值500,但是consol log show

  

data.result.FJ7f3RA_yFc.status

我想要获得价值

  

500

HTML代码

<html>
<head>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.7.2.min.js"></script>

<script>
$(function(){
    var o = "FJ7f3RA_yFc";
    $.getJSON('https://api.mydom.com/1/file/info?file='+o, function(data) {
        var i = o;
        var status = 'data.result.'+i+'.status';
        console.log(status);
    });
});
</script>
</head>

<body>

</body>

</html>

返回json数据

{"status":200,"msg":"OK","result":{"FJ7f3RA_yFc":{"id":"FJ7f3RA_yFc","status":500,"name":"519319320_2v1.mp4","size":"8490858","sha1":"35266f4bc38cb9668f3fd52399aa735d1e69125a","content_type":"video\/mp4","cstatus":"1"}}}

0 个答案:

没有答案