title: Calling a C# method with jquery
body: <p>I am trying to call a method with <code>jQuery</code> on a button click.This is waht I have so far:</p>
  
  <pre><code>$("a.AddToCart").click(function () {
              var link = document.URL;
  
              $.ajax({
                   type:"POST",
                   url: "/Account/AddToCartHack",
                   data: {url : link},
                   contentType: "application/json; charset=utf-8",
                   dataType: "json"
              });
          });
  
  
  [WebMethod]
      public void AddToCartHack(string url)
      {
          GeneralHelperClass.URL = url;
      }
  </code></pre>
  
  <p>What I am trying to do here is when I click the link with class add to cart I want to call the method <code>AddToCartHack</code> and pass it the curent URL as a parameter.
     I must be doing something wrong because it seems that <code>AddToCartHack</code> is not being called.</p>
  
  <p>What am I doing wrong?</p>