title: How to Call Default.aspx.cs page method from Jquery Ajax?
body: <p>I have a registration form(Default.aspx) which initially show's only 2 field's and a button (Name, email) when user click's on button Jquery makes an Ajax call to Default.aspx.cs function which query db to check for the user, and if it return no then the form expands itself adding registration fields.</p>
  
  <p>I am not able to make a call to Defualt.aspx.cs
  my Default.aspx code is :</p>
  
  <pre><code>  &lt;script type="text/javascript"&gt;
          $(document).ready(function() {
              $('#btnDownload').click(function() {
                  //$('#secondary').toggle(1000)
                  $.ajax({
                      type: "POST",
                      url: "Default.aspx/PassData",
                      data: "{}",
                      contentType: "application/json; charset=utf-8",
                      dataType: "json",
                      success: AjaxSucceeded,
                      error: AjaxFailed
                  });
              });
              function AjaxSucceeded(result) {
                  alert(result.d);
              }
              function AjaxFailed(result) {
                  alert('Failed');
              } 
          });
  
      &lt;/script&gt;
  </code></pre>
  
  <p>And Default.aspx.cs is (for test purpose) :</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  
  public partial class _Default : System.Web.UI.Page 
  {
      protected void Page_Load(object sender, EventArgs e)
      {
  
      }
      private static string PassData(string id)
      {
          return "Pass";
      }
  }
  </code></pre>
  
  <p>But every-time I run the code JS returns error :</p>
  
  <pre><code>Uncaught ReferenceError: com is not defined
  POST http://localhost:2305/temp/Default.aspx/PassData 500 (Internal Server Error) 
  </code></pre>
  
  <p>I check few posts but non of them had been answered/resolved.</p>
  
  <p>Any kind of help would be highly appreciated.</p>
  
  <p>Thanks in advance</p>