当前位置:编程学习 > asp >>

MVC action返回partialView前台html 拼接

//后台

 

 

[HttpPost]

        public ActionResult GetNextLazyLoadProduct(int[] productIdList)
        {
            var products = _productService.GetProductsByIds(productIdList);
            var preparedModel = PrepareProductOverviewModels(products);
            return PartialView("_LazyLoadProducts", preparedModel);

        }

 


//前台

 


var url = "@Url.Action("GetNextLazyLoadProduct")";
                    $.ajax({
                        url: url,
                        type: "POST",
                        datatype: "json",
                        contentType: "application/json",
                        data: JSON.stringify({ productIdList: array }),
                        error: function () {
                        },
                        success: function (data) { 
                            $("#lazyScrollLoading").append(data);
                            $("#lazyLoadNum").attr("value", nextLazyLoadNum);
                        }                 
                    });      


 

补充:Web开发 , ASP.Net ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,