title: JavaScript is not working on partial views retrieved from paging links
body: <p>I have the following main view inside my asp.net MVC razor view engine:-</p>
  
  <pre><code>&lt;div&gt;&lt;span class="b"&gt; There are @Model.TotalItemCount Virtual Machines.&lt;/span&gt;&lt;/div&gt;
  @Html.Partial("_PagedVMTable",Model)
  &lt;i class=" icon icon-blue icon-star-on "&gt;&lt;/i&gt; IT360 Data
      @section Scripts {
      @Scripts.Render("~/bundles/jqueryval")
  &lt;script type="text/javascript"&gt;
          $(document).ready(function () {
  
              $("#ServerSort").click(function () {
  
                  $.ajax({
                      type: "Get",
                      url: "@Url.Action("Index","VirtualMachine")",
  
                      data: { searchTerm:  "@ViewBag.searchTerm.ToString()" , page:"1" , sort: "@ViewBag.ServerSortPam" },
                      //contentType: "application/json; charset=utf-8",
                      //dataType: "json",
                      //cache: false,
                      success: successFunc,
                      error: errorFunc
                  });
  
                  function successFunc(data, status) {     
                      $("#VMTable").html(data);
                  }
  
                  function errorFunc() {
                      alert('error');
                  }
              })
              $("#RackSort").click(function () {
  
                  $.ajax({
                      type: "Get",
                      url: "@Url.Action("Index","VirtualMachine")",
  
                      data: { searchTerm: "@ViewBag.searchTerm.ToString()", page: "1", sort: "@ViewBag.RackSortPam" },
                      //contentType: "application/json; charset=utf-8",
                      //dataType: "json",
                      //cache: false,
                      success: successFunc,
                      error: errorFunc
                  });
  
          function successFunc(data, status) {
              $("#VMTable").html(data);
          }
  
          function errorFunc() {
              alert('error');
          }
      })
          });
      &lt;/script&gt;
  
  }
  </code></pre>
  
  <p>and the following part of the _PagedVMTAble partial view:-</p>
  
  <pre><code> &lt;th&gt;
   &lt;a id="ServerSort"&gt;@Html.DisplayNameFor(model=&gt;model.ServerID)&lt;/a&gt;
   &lt;/th&gt;
  
   &lt;th&gt;
   &lt;a id="RackSort"&gt;Rack  @Html.DisplayNameFor(model=&gt;model.Server.Rack.Technology.Tag) &lt;/a&gt;
   &lt;/th&gt;
  </code></pre>
  
  <p>Now the javaScript will work fine when calling the main view, but after clicking on a paged link (which will update the partial view only) the javaScript will stop working. I mean by stop working is that when I click on the “RackSort” OR “ServerSort” links, nothing will happen?</p>
  
  <p>So can anyone advice ?</p>
  
  <p>Thanks</p>
  
  <p>Regards</p>