• JS FormData Post WebApi


            var dataObj = {
                "cateId": 7,
                "pageCount":10,
                "pageNum":0,
                "S_CaoZuoR":"sclgs",
                "B_IsShow":1
            };
            postFormData(dataObj);    



        function postFormData(dataObj) {

            var formData = new FormData();
            for (var key in dataObj) {
                formData.append(key, dataObj[key]);
            }

            $.ajax({
                type: "POST",
                url: url,
                cache: false,
                processData: false,
                contentType: false,
                data: formData,
                success: function (data) {
                    return data;
                },
                error: function (xhr, state, err) {
                    alert(JSON.stringify(err));
                }
            });

        }
     [HttpPost]
            [Route("content/SelectPageByAdmin3")]
            public IEnumerable<PW_Content> SelectPageByAdmin3()
            {
                int cateId = Convert.ToInt32(HttpContext.Current.Request.Params["cateId"]);
                int pageCount = Convert.ToInt32(HttpContext.Current.Request.Params["pageCount"]);
                int pageNum = Convert.ToInt32(HttpContext.Current.Request.Params["pageNum"]);
                string S_CaoZuoR = HttpContext.Current.Request.Params["S_CaoZuoR"].ToString();
                int B_IsShow = Convert.ToInt32(HttpContext.Current.Request.Params["B_IsShow"].ToString());
    
                return Service.SelectPageByAdmin2(cateId, pageCount, pageNum, S_CaoZuoR, B_IsShow);
            }
  • 相关阅读:
    学习日报
    学习日报
    学习日报
    学习日报
    《人月神话》读后感(第一二章)
    线程
    for each
    类的访问属性
    异常
    输入输出流
  • 原文地址:https://www.cnblogs.com/0-0snail/p/12985846.html
Copyright © 2020-2023  润新知