I am trying to generate enough pagination links accordingly to amount of job offers. (I am building something related to job searching).
I am trying to call Send function after click event but I have another jQuery targeting that list.
<li class="active page-number"><a href="#" onclick="Send(2)">2</a></li>
<script>
///Custom scripts
///
function Send(page) {
$.post("/JobOffer/JobList/", { page: page });
}
$(document).ready(function () {
$(".pagination>li").click(function () {
$(".pagination>li.active").removeClass("active");
$(this).addClass("active");
});
});
</script>
So when I click on ".pagination>li" I go to Action JobList in JobOffer controller marked with [HttpPost].
[HttpPost]
public ActionResult JobList(int? page)
{
var pageNumber = page ?? 1;
var pageSize = 3;
/*Some magic*/
viewModel.OfferCount = GetJobOfferCount(Enums.JobOfferType.Employer);
viewModel.PageSize = pageSize;
return View(viewModel);
}
And then I receive page parameter as null.
How could I send page parameter to my action method? Thanks in advance.