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