zoukankan      html  css  js  c++  java
  • mvc 前台传入后台

    转自: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.         });  
  • 相关阅读:
    二进制流 最后一段数据是最后一次读取的byte数组没填满造成的
    java中的匿名内部类总结
    决策树构建算法之—C4.5
    Segment公司--整合数据进行分析
    UBuntu安裝使用PIP
    undefined reference to “boost” in Qt—Ubuntu
    Ubuntu14.04引导菜单修复
    ubuntu16.04下编译安装OpenCV
    PCL:Ubuntu下安装配置PCL
    Ubuntu安装配置Python.pyDev
  • 原文地址:https://www.cnblogs.com/ccqin/p/8023773.html
Copyright © 2011-2022 走看看