title: Using jQuery.ajax() to access c# WebMethod results in 'Unknown Web Method'
body: <p>This is my first attempt at using jQuery.ajax() to call a WebMethod. I have searched and searched stackoverflow, as well as Google I don't know how many times, and at this point I feel I'm just trying random fixes I find, hoping something works. I've certainly stopped learning, so I thought it time to ask.</p>
  
  <p>My error: Unknown web method Date. Parameter name: methodName. </p>
  
  <p>My class and WebMethod:</p>
  
  <pre><code>[ScriptService]
  public partial class _Maps : Page
  {
  
      protected void Page_PreLoad(object sender, EventArgs e)
      {
  
      }
  
      protected void Page_Load(object sender, EventArgs e)
      {
  
      }
  
      [WebMethod]
      public static string Date()
      {
          return DateTime.Now.ToString();
      }
  }
  </code></pre>
  
  <p>my page:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;jQuery&lt;/title&gt;
      &lt;script type ="text/javascript" src ="Scripts/jquery-1.8.2.min.js"&gt;&lt;/script&gt;
      &lt;script type ="text/javascript" src ="Scripts/cSharp.js"&gt;&lt;/script&gt;   
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id="clickArea" style="height: 1000px"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and my Javascript:</p>
  
  <pre><code>$(document).ready(function ()
  {
      $("#clickArea").click(function ()
      {
          alert("Clicked");
          $.ajax(
              {
                  type: "POST",
                  url: 'Maps.aspx/Date',
                  contentType: "application/json; charset=utf-8",
                  dataType: "json",
                  success: function (msg)
                  {
                      alert(msg);
                      $("#clickArea").text(msg.d);
                  },
                  error: function(xhr, msg, msg2)
                  {
                      alert(msg2);
                      alert(xhr.responseText);
                  }
              });
      });
  });
  </code></pre>
  
  <p>I know this question has been asked numerous times, but I have limited experience with the technologies I'm using, and I know I must be missing something silly. I've been at this almost all day, and I feel I am just running in circles now. I can post more information if needed.</p>
  
  <p>Thanks.</p>