js 循环list

$.ajax({
                 type : "POST",
                 data:{
                     createStartTime:'',
                     createEndTime:''
                 },
                 url : "<%=request.getContextPath()%>/vehicleDataController/vehicleModleData",
                 dataType : "json",
                 async: false,//同步
                 success : function(msg) { //msg 返回是个MAP KEY值为data
                       var data = msg.data;//根据K值得到一个LIST
                       if(data){
                              for(var i = 0;i<data.length;i++){  //循环LIST
                                 var veh = data[i];//获取LIST里面的对象
                                 result.push({  
                                      value:veh.status, 
                                      name:veh.carname
                                 });  

                              }
                       }
                 }
             });

 

posted @ 2017-09-29 17:37  汪强胜  Views(4003)  Comments(0Edit  收藏  举报