title: Adding an asp.net custom user control from JQuery
body: <p>I am using following JQuery code from somewhere on the internet to load content on browser window scroll. </p>
  
  <pre><code>var pageIndex = 1;
      var pageCount;
      $(window).scroll(function () {
          if ($(window).scrollTop() == $(document).height() - $(window).height()) {
              GetRecords();
          }
      }); 
      function GetRecords() {
          pageIndex++;
          if (pageIndex == 2 || pageIndex &lt;= pageCount) {
              $("#loader").show();
              $.ajax({
                  type: "POST",
                  url: "CS.aspx/GetCustomers",
                  data: '{pageIndex: ' + pageIndex + '}',
                  contentType: "application/json; charset=utf-8",
                  dataType: "json",
                  success: OnSuccess,
                  failure: function (response) {
                      alert(response.d);
                  },
                  error: function (response) {
                      alert(response.d);
                  }
              });
          }
      }
      function OnSuccess(response) {
          var xmlDoc = $.parseXML(response.d);
          var xml = $(xmlDoc);
          pageCount = parseInt(xml.find("PageCount").eq(0).find("PageCount").text());
          var customers = xml.find("Customers");
          customers.each(function () {
              var customer = $(this);
              var table = $("#dvCustomers table").eq(0).clone(true);
              $(".name", table).html(customer.find("ContactName").text());
              $(".city", table).html(customer.find("City").text());
              $(".postal", table).html(customer.find("PostalCode").text());
              $(".country", table).html(customer.find("Country").text());
              $(".phone", table).html(customer.find("Phone").text());
              $(".fax", table).html(customer.find("Fax").text());
              $("#dvCustomers").append(table).append("&lt;br /&gt;");
          });
          $("#loader").hide();
      }
  </code></pre>
  
  <p>As you can see its adding HTML table on response success. But I have an asp.net user-control that I want to add instead of this HTML table when content scrolls (In short I want to add a server side control from JQuery). I can't add user-control's HTML in place of this HTML table because its code is too lengthy and complex and I don't know much JQuery. I am the beginner of the beginner concept of JQuery. Moreover I am a specialist in back-end programming. So, I can't code that business logic in JQuery. So any one please help me in doing so.</p>