首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

return Content("0"),该怎么处理

2013-04-09 
return Content(0)以前只看到Return view,return Content(0)百度下,就是返回一个文本,这个文本谁来接

return Content("0")

以前只看到Return view,return Content("0")百度下,就是返回一个文本,这个文本谁来接收呢? 返回后页面是个什么效果?


        [HttpPost, ValidateInput(false)]
        public ActionResult Show(int id, FormCollection values)             
        {
            try
            {
                RegisteredUser va = GetCurrentUser();           
                if (va != null)
                {
                    var cm = new Comment();                               
                    cm.VideoID = id;                                      
                    cm.Content = values["Content"];                       
                    if (CommentBLL.AddComment(cm) == 1)
                        return PartialView("UCC",
                                           GetPagedCommentsAndRepliesByVideoId(cm.VideoID, 1, CommentPageSize));
                    return Content("0");   
                }
                return Content("-1");
            }
            catch (Exception ex)
            {
                return Content(ex.Message);
            }

        }

[解决办法]
本帖最后由 net_lover 于 2012-10-14 15:59:18 编辑 返回到response 中,也就是直接返回到浏览器上


一般使用ajax进行验证,直接返回0,-1进行判断,xmlhttp.resposneText
[解决办法]
谁调用的谁接

热点排行