MVC Action返回Json
2015-09-14 17:48 只喝牛奶的杀手 阅读(935) 评论(0) 收藏 举报Action
[HttpPost]
        public ActionResult Edit(Study_CourseHourModel model)
        {
            if (ModelState.IsValid)
            {
                model.UId = LoginUserId;
                bool flag = BLLControl.Study_CourseHourBLL.Update(model);
                if (flag)
                {
                    return this.Json(new { Result = 1, Msg = "操作成功"  }, JsonRequestBehavior.AllowGet);
                }
                return Json(new { Result = 2, Msg = "操作失败" }, JsonRequestBehavior.AllowGet);
            }
            return ActionResult_ModelErrors();
}
Js:
   $("#editCH").click(function () {
        $("form").ajax({
            type: "POST",
            dataType: "json",
            url: "/Member/CourseHour/Edit",
            success: function (data) {
                showTips("操作成功");
                window.location.href = "/Member/CourseHour/Index?courseId=" + $('#Study_Course').val();
            }
        });
    });  
欢迎大家关注微信号killerhub,微信公众号名称:只喝牛奶的杀手, 扫下面的二维码或者收藏下面的二维码关注吧(长按下面的二维码图片、并选择识别图中的二维码)

                    
                
                
            
        
浙公网安备 33010602011771号