im using PagedList with ajax. everything work fine. but the only problem is that the page links are not getting update as i click on them.
this is partial view containing the list
@model IEnumerable<UniProject.Models.Short_Code>
<table class="table table-condensed table-bordered table-hover table-striped">
<tr>
<th>
Shortcode
</th>
<th>
Service
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.ServiceCode)
</td>
<td>
@Html.DisplayFor(modelItem => item.Service)
</td>
</tr>
}
</table>
this is my view
@model PagedList.IPagedList<UniProject.Models.Short_Code>
@using PagedList.Mvc
<link type="text/css" rel="stylesheet" href="~/Content/PagedList.css" />
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="~/Scripts/jquery-1.10.2.js"></script>
<script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
<div class="col-lg-8">
<div id="tableDiv">
@Html.Partial("_shortcode_table" , Model)
</div>
<div id="myPager">
@Html.PagedListPager(
Model,
page => Url.Action(
"Index",
new
{
page = page
}
)
)
</div>
</div>
<script>
$(function () {
$('#myPager').on('click', 'a', function () {
$.ajax({
url: this.href,
type: 'GET',
cache: false,
success: function (result) {
$('#tableDiv').html(result);
}
});
return false;
});
});
</script>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
please help with this issue that where am i doing wrong. any help would be welcome . thanks