jquery 简单的绑定问题,急!!!在线等
有一json数据如下:
var json="
{"d":[{"__type":"KH.FMCG.Model.Pro_VisitPlan","VisitPlanId":3,"VisitPlanCode":"PL000020121219165059","ProjectId":1,"ShopId":6,"VisitDate":"/Date(1354377600000)/","EnterTime":"01:10","LeaveTime":"02:20","ApprovalState":0,"ExecuteState":0,"IsCollectSales":true,"IsCollectStock":false,"IsCollectSurvey":true,"Remark":"dtdfgdf","CreateUser":1,"CreateDate":"/Date(-62135596800000)/","UpdateUser":0,"UpdateDate":"/Date(-62135596800000)/","Valid":0}]}
"
将以上json数据中的VisitPlanId ,VisitPlanCode,Remark 三个字段的值绑定出来
$.each(json, function (i) {
$("#demo").append("<a id='a" + VisitPlanId + "'>" + Remark + "</a>");
});
var dataObj=eval("("+json+")");
var json = '{"d":[{"__type":"KH.FMCG.Model.Pro_VisitPlan","VisitPlanId":3,"VisitPlanCode":"PL000020121219165059","ProjectId":1,"ShopId":6,"VisitDate":"/Date(1354377600000)/","EnterTime":"01:10","LeaveTime":"02:20","ApprovalState":0,"ExecuteState":0,"IsCollectSales":true,"IsCollectStock":false,"IsCollectSurvey":true,"Remark":"dtdfgdf","CreateUser":1,"CreateDate":"/Date(-62135596800000)/","UpdateUser":0,"UpdateDate":"/Date(-62135596800000)/","Valid":0}]}';
var data = eval('(' + json + ')');
$.each(data, function (i) {
$.each(data.d, function (j) {
$("#demo").append("<a id='a" + this.VisitPlanId + "'>" + this.Remark + "</a>");
});
});