js 循环list

时间:2024-01-14 12:53:14
$.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 = ;i<data.length;i++){ //循环LIST
var veh = data[i];//获取LIST里面的对象
result.push({
value:veh.status,
name:veh.carname
}); }
}
}
});