title: Ajax call to c# function not working
body: <p>I'm trying to use Ajax to call a C# function but the call is not working.The script shows the hello message but does not show the success/error message.What am i doing wrong</p>
  
  <p>Java script</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function () {
          $('#btnsave1').click(function () {
              alert("hello");
              $.ajax({
                  type: "POST",
                  contentType: "application/json; charset=utf-8",
                  url: "LeaveSurrender.aspx/apply",
                  dataType: "json",
                  success: function () {
                      alert('Successfully Saved');
                      // window.location.href = "ClubCreation.aspx";
                  },
                  Error: function () {
                      alert('error');
                  }
              });
  
          });
  
      });
  </code></pre>
  
  <p></p>
  
  <p>C# Method </p>
  
  <pre><code> protected void apply()
      {
          MessageBox.Show("hi");
  }
  </code></pre>