ccqin的blog

待定

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

转自:http://blog.csdn.net/huangyezi/article/details/45274553

 

一个很简单的分部视图,Model使用的是列表,再来看看调用该分部视图的action

 

 

[csharp] view plain copy
 
  1. [HttpPost]  
  2.         public ActionResult GetUserByGroupID(string groupID)  
  3.         {  
  4.             var result = this.T_USERService.T_USERRepository.Entities.Include("Group").Where(p => Equals(p.Group.ID, groupID));  
  5.             //return Json(result.AppendData);  
  6.             return PartialView("GetUserList", result);  
  7.         }  

同样也是很简单的一个查询,使用了一个groupID的参数,这样就需要我们在ajax请求时传递一个group的id

 

 

[html] view plain copy
 
  1. $('#tree').on('nodeSelected', function (event, node) {  
  2.             var guid = node.id;  
  3.             $.ajax({  
  4.                 type: 'POST',  
  5.                 url: "/Auth/UserManager/GetUserByGroupID",  
  6.                 data:{groupID:guid},  
  7.                 dataType: 'html',  
  8.                 async: false,  
  9.                 success: function (responseData) {  
  10.                     $('#user').html(responseData);  
  11.                 },  
  12.                 error: function (XMLHttpRequest, textStatus, errorThrown) {//请求失败处理函数  
  13.                     console.log("请求失败,无法获取分组数据");  
  14.                 }  
  15.             });  
  16.               
  17.         });  
posted on 2017-12-11 16:37  ccqin  阅读(599)  评论(0编辑  收藏  举报