I send a page number to the controller. And I pull the relevant record and make a return view. I send a request to this method with ajax. Since the page is not refreshed after the return view, I cannot print the current records I want on the page. How can I solve this problem?
Controller;
` public IActionResult Index(int pageNumber = 1)
{
_leadDataPagerInputModel.PageNumber = pageNumber;
_leadDataPagerInputModel.PageSize = 10;
ResponseModel<LeadDataDto> responseModel = new ResponseModel<LeadDataDto>();
IResultObjectPagedListModel<LeadDataDto> leadDataResult = _leadDataBusinessManager.GetList(_leadDataPagerInputModel);
if (leadDataResult.IsSuccess)
responseModel.Items = leadDataResult.Data;
responseModel.Success = leadDataResult.IsSuccess;
responseModel.ErrorMessage = leadDataResult.Message;
return View(leadDataResult);
}`
` onPageClick: function (pageNumber, event) {
$.ajax({
type: "POST",
url: "@Url.Action("Index")",
data: { pageNumber: pageNumber },
success: function (result) {
},
error: function (req, status, error) {
alert(error);
}
});`
I want new data to come with the page number I sent, but I don't know how to refresh the data on the page.