各位老师好:
请教个服务端序列化到前端的输出异常的问题,没有采用异步申请的方式,而所有代码写到传cshtml.
-> var jsonlist = new JavaScriptSerializer().Serialize(list);/序列化对象/ ->在客户端接收 var jsonlistVal = '[{"Id":106,"Name":"b4b90824-d2b3-41bb-9a2f- 0b9996c55e55.jpg","Value":"http://www.baidu.com/","Value2":"3","V alue3":null,"ParentID":86} ,{"Id":107,"Name":"3617d05d-eb3f-4e8a-b686- 64245b87548b.jpg","ParentID":86,"Value":"http://www.baidu.com/","Value2&quo t;:"2","Value3":null} ]';/*序列化*/ ->转码 var jsonlistVal = '@HttpUtility.UrlDecode(jsonlist)'; ->遍历 $.each(jsonlistVal, function (i, o) { var Temp1 = $(".maintopr #a" + i + "").attr('href',(o.Value)) })
->>问题: o.Value 输出 [,而不是http://www.baidu.com/