jquery怎么判断json数组对象为空

2024-11-10 03:02:20
推荐回答(3个)
回答1:

使用length属性

回答2:

var str = eval('[{"id":1,"sex":"","age":2,"userName":"1","job":"","password":""},{"id":2,"sex":"","age":2,"userName":"1","job":"","password":""}]');$.each(str, function() {alert(this.id);});自行参考。

回答3:

数组.length==0就是空