1、在jsp頁面的js中可以用jsp標籤
var patientInfoList={patientId:"${session.patientId}"};
var docDepList=[],noTypeMap=["","普通號" ,"主治醫師號","副主任醫師號","主任醫師號"];
idx" var="list" items="${docDepList}">
docDepList}"> docDepList[${idx.index}
]={doctorId:"${list.doctorId}",departmentName:"${list.departmentName}"};
docDepList
是一個數組,在js賦值是裡邊可以是物件
patientInfoList
是一個物件
2.如果ajax傳過來的值是
程式碼:
{"birthday":"1977-07-08","contactInfoList":[],"gender":"男"}形式可以用eval("(" data ")").birthday獲得birthday的值
[{"contactInfo_ID":0,"create_Time":""create_Time}]形式相當於一個陣列可以用eval("(" data ")")[0].create_Time得到
[ {"contactInfo_ID":0,"create_Time":""create_Time},{"contactInfo_ID":0,"create_Time":""create_Time}],{"contactInfo_ID":0,"create_Time":""create_Time},{ "contactInfo_ID":0,"create_Time":""create_Time}]var dataArr=eval("(" data ")");
for(var i=0;i
alert(dataArr[i].create_Time);
}