嗨需要循環,我有以下LINQ查詢:`Linq`查詢包含組的加入和整個JSON數組
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容器,上面的循環似乎沒有工作,因爲意達不被認可,因此可以通過單個項目沒有環item.logindetail。
謝謝
嗨仍無法當我使用item.logindetail工作什?謝謝 –
對不起,我的意思是說這個工程,但函數內的itema仍然沒有返回? –