当前位置: 代码迷 >> Ajax >> ajax Post 一直返回的是error ,为啥
  详细解决方案

ajax Post 一直返回的是error ,为啥

热度:2306   发布时间:2014-03-01 00:37:27.0
ajax Post 一直返回的是error ,为什么?
代码如下:ajax提交后,测试发现status==200是正常的,但是一直返回error,为什么?


jquery:
<script type="text/javascript">
    function AjaxContent(id) {
        $.ajax({
            url: "/Yghjy/Detail",
            type: "POST",
            dataType: "json",
            data: { _uid: id },
            success: function(data) {
                if (data.status != 200) {
                    alert("ddd");
                }
                //                $(".Content").html("").append(data.HtmlStr);
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                //                $.jMessageBox.show('系统消息', '发生网络错误,请重试.');
                alert("fff");
            }
        });
    }
</script>


后台code:

        public ActionResult Detail()
        {

            #region 最新动态

            var zxdtList = _kdnewsservice.GetKdNewsTab(0, null, "1", 3, 7);
            ViewData["zxdtList"] = zxdtList;

            #endregion

            if (Request["_uid"] != null)
            {
                var xwnrList = _kdnewsservice.GetKdNewsByNid(Int32.Parse(Request["_uid"]));
                ViewData["xwnrList"] = xwnrList;
            }
            else
            {
                var xwnrList = _kdnewsservice.GetKdNewsByNid(zxdtList[0].Nid);
                ViewData["xwnrList"] = xwnrList;
            }
            
            return View();
        }

        [HttpPost]
        public ActionResult Detail(string _uid)
        {
            //var xwnrList = _kdnewsservice.GetKdNewsByNid(Convert.ToInt32(_uid));
            //Response.Write(xwnrList);
            //Response.End();
            return RedirectToAction("Detail", new
                                              {
                                                  _uid = _uid
                                              });
            //return Json(new AjaxData
            //            {
  相关解决方案