首页 > 代码库 > JOSN 为空数据的处理

JOSN 为空数据的处理

 for(var i=0,l=thisuserList.length;i<l;i++){
            	     for(var key in thisuserList[i]){
            	       if(thisuserList[i][key]==null){
            	    	   thisuserList[i][key]="暂无数据";
            	    	   //thisHtml+="<tr><td>"+value.userName+"</td><td>"+value.departName+"</td><td>"+value.postName+"</td><td>"+value.status+"</td><td>"+value.telNum+"</td><td>"+value.electricity+"</td><td>"+value.workTime+"</td><td>"+value.workoutTime+"</td><td>"+value.softVersion+"</td><td>"+value.phoneModel+"</td><td><a href=‘javascript:void(0)‘ onclick=‘showDetail("+value.userId+")‘>查看</a></td></tr>";              	                       	
            	       }
            	     }
            	  }

  2

 $.each(thisuserList,function(key,value){ 
                	for(var key1 in value) {
    					if( value[key1]==null){
    						value[key1]="";
    					}
    				}
                    thisHtml+="<tr><td>"+value.userName+"</td><td>"+value.departName+"</td><td>"+value.postName+"</td><td>"+value.status+"</td><td>"+value.telNum+"</td><td>"+value.electricity+"</td><td>"+value.workTime+"</td><td>"+value.workoutTime+"</td><td>"+value.softVersion+"</td><td>"+value.phoneModel+"</td><td><a href=‘javascript:void(0)‘ onclick=‘showDetail("+value.userId+")‘>查看</a></td></tr>";              	               	
                })

  

JOSN 为空数据的处理