首页 > Web开发 > 详细

MVC-AJAX-JSON

时间:2017-05-18 15:32:06      阅读:265      评论:0      收藏:0      [点我收藏+]

前台:

 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");
        }

MVC-AJAX-JSON

原文:http://www.cnblogs.com/914556495wxkj/p/6873522.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!