如何在jquery中迭代下面的数组

时间:2017-02-09 11:08:34

标签: jquery json

请帮我在jquery中迭代下面的数组并获取每个值。

var data = [{"value":"150000","completion":"10.00","coal":"32.40","local":"144.00","bacs":"35.00","landRegistry":"200.00","solFee":"395.00","vatOnSolFees":79,"stampDuty":1500,"total":2395.4},{"value":"120000","completion":"1.00","coal":"3.40","local":"14.00","bacs":"3.00","landRegistry":"100.00","solFee":"35.00","vatOnSolFees":7,"stampDuty":150,"total":395.4}];

1 个答案:

答案 0 :(得分:0)

使用jquery循环遍历数组的元素

subprocess.run(commandC, shell=True)
commandC = 'set "SYMCLI_OFFLINE=1" & set "SYMCLI_DB_FILE=C:\PROGRAM FILES\EMC\SYMAPI\DB\SYMAPI_DB.BIN" & call symaccess -sid %s list -type storage -dev %s > outS.txt & call symaccess -sid %s list -type storage -dev %s > outT.txt' % (
        sid, devS, sid, devT)

如果你想循环对象添加另一个循环

    var data = [{"value":"150000","completion":"10.00","coal":"32.40","local":"144.00","bacs":"35.00","landRegistry":"200.00","solFee":"395.00","vatOnSolFees":79,"stampDuty":1500,"total":2395.4},{"value":"120000","completion":"1.00","coal":"3.40","local":"14.00","bacs":"3.00","landRegistry":"100.00","solFee":"35.00","vatOnSolFees":7,"stampDuty":150,"total":395.4}];
    
    $.each(data,function(i,v){
       console.log(v.value);
    });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>