Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. @model IEnumerable<AjaxPaging.Models.Person>
  2. @{
  3.     ViewBag.Title = "Index";
  4. }
  5. <h2>
  6.     Person List</h2>
  7. <div id="PersonContainer">
  8.     @Html.Partial("_PersonList", Model)
  9. </div>
  10. <script type="text/javascript">
  11.     function OnCriteria(page, includeNewCriteria) {
  12.        
  13.         var crit;
  14.        
  15.         if (includeNewCriteria) {
  16.             crit = ($('#criteria'))[0].value;
  17.         } else {
  18.             crit = ($('#lastedCriteria'))[0].value;
  19.         }
  20.  
  21.         $.ajax(
  22.           {
  23.               type: "GET",
  24.               url: "/Home/GetPersons?criteria=" + crit + "&page=" + page,
  25.        
  26.              success: function (result) {
  27.                  $("#PersonContainer").html(result.toString());
  28.               },
  29.  
  30.               error: function () {
  31.                   alert("Searching failed!");
  32.               }
  33.           });
  34.     }
  35. </script>
  36.