This function is generating a array with json objects on it:
var estoque={};
function unpack_estoque(tnm,total,estoque_vl,id,tid,st) {
tnm=tnm.split("|");
total=total.split("|");
estoque_vl=estoque_vl.split("|");
id=typeof id != 'undefined' ? id.split("|") : null;
tid=typeof tid != 'undefined' ? tid.split("|") : null;
st=typeof st != 'undefined' ? st.split("|") : null;
for (var i in tnm)
estoque[i]={
"id": id != null ? id[i] : null,
"tid": tid != null ? tid[i] : null,
"total": total[i],
"estoque": estoque_vl[i],
"tnm": tnm[i],
"st": st != null ? st[i] : null
};
}
Now how do i get the estoque
length to loop through the collected items?
estoque.length
returns undefined
while for (var i in estoque)
loops through JSON object and not estoque[] root array.
Thanks.