MVC-AJAX-JSON

前台:

 function get_page_count() {
        $.ajax({
            type: "GET",
            data: { typeId: $("#select").val(), keyWord: $("#key_word").val() }, 
            cache: false,
            url: '/ResourceProvie/get_pageCount',
            dataType: "json",
            success: function (result) {

                alert("a" + result);
            },
            error: function (result) {
                alert(result);
                alert("b");
            }
        }

        );
后台:
 public ActionResult get_pageCount(int? typeId, string keyWord)
        {
            int pageCount = 0;
           
             _resourceRepository.get_pageCount(typeId, keyWord, ref pageCount);
             Hashtable hash = new Hashtable();
             hash["pageCount"] = pageCount;
             return Json(hash,"text/html;charset=UTF-8");
        }
posted @ 2017-05-18 15:10  914556495  阅读(119)  评论(0编辑  收藏  举报