日期:2014-05-16 浏览次数:20706 次
var all = $("#t1").datagrid("getData");
var sum=0;
var json="[";
$.each(all.rows, function(i, p) {
//var num=$('#t1 input[id='+p.product_id+']').val();
var num=$("#"+p.product_id).val();
var money=p.product_money;
var allMoney=(num-0)*(money-0); //总金额
sum+=allMoney;
json+="{";
json+=" \"product_id\":\""+p.product_id+" \",\"prolist_num\":\""+ num+"\",\"product_money\":\""+ money+"\",\"allMoney\":\""+ allMoney+"\"";//
json+="},";
});
json=json.substring(0,json.length-1);
if(json.length==1)
json+="[";
json+="]";
<script src="http://www.coding123.net/rardownload/20130106/20130106170832648.js"></script>
<script>
var d = [{ a: 1 }, { b: 2 }, { c: 3}];
d = JSON.stringify(d);
alert(d)
</script>