【发布时间】:2015-10-10 14:18:40
【问题描述】:
您好,我有以下 linq 查询:
var resulta = from a in db.users
join b in db.userlogin on a.ID equals b.ID into UserGroup
select new {a.age , a.location , logindetail = UserGroup}
var resultb = contains other linq data which is irrelvant for this question
var resultc = new { users = resulta , business = resultb }
这都返回在 MVC 视图中输出的 json 数据。剃刀 HTML 包含以下内容:
//this loops throughout the user data and find their indexes along with values
$.each(data.users) , function (index , item) {
//This variable contains an empty string which will be appended to with the following inner loop
var string = '';
// this is a inner loop to search throughout UserGroup
$.each(item.logindetail) , function (index , itema) {
string += <span> + itema.usergroup + itema.email + itema.password + </span>;
在我可以将以下内容附加到 div 容器之前,上面的循环似乎不起作用,因为 itema 没有被识别,因此无法遍历 item.logindetail 中的各个项目。
谢谢
【问题讨论】:
标签: javascript jquery json linq model-view-controller