title: How to call a non-static method from asp.net code behind using jQuery
body: <p>Within a web form I have the following jQuery setup to call a method in my code behind file. </p>
  
  <pre><code> &lt;script src="js/jquery-1.7.js" type="text/javascript"&gt;&lt;/script&gt;
  
      &lt;script type="text/javascript"&gt;
          $(function () {
              $("#newBtn").click(function () {
                  $.ajax({
                      type: "POST",
                      url: "AJAXCaller.aspx/GetTimer",
                      data: "{}",
                      contentType: "application/json; charset=utf-8",
                      dataType: "json",
                      async: true,
                      cache: false
  
                  });
                  return false;
              });
          });
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
      &lt;div&gt;
      &lt;a href="#" class="link1" runat="server"&gt;Click here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
      &lt;asp:LinkButton ID="newBtn" runat="server" Text="ASP Link" /&gt;
      &lt;asp:Label ID="time_lbl" runat="server" /&gt;
      &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>And within the code behind I have the following: </p>
  
  <pre><code>[WebMethod]
          public void GetTimer()
          {
              time_lbl.Text = DateTime.Now.ToString();
          }
  </code></pre>
  
  <p>I realize this currently does not work in the current syntax. </p>
  
  <p>I've been able to access the method if I set it to static however I don't want to just return a string or single value. I want to access a method that in turn access a web service to return a collection of data. </p>
  
  <p>I would like to know if it is possible to perform something like this where I can call a method and have it update a field in the UI such as the above method where when called the server side script would to the ui a value for the date field? </p>
  
  <p>Thanks in advance for any suggestions.</p>