title: Sending object on AJAX call to WebMethod
body: <p>I am trying to send a JSON object to a C# method, and return a different (also JSON) object.</p>
  
  <p>The object is created in JavaScript:</p>
  
  <pre><code>    lottery = {
          TotalValue: totalValue,
          Players: txtPlayers.value,
          TicketPrice: txtAmount.value,
          FirstPrize: prize,
          MyComission: myComission,
          MyRate: myRate,
          SellerComission: sellerComission,
          SellerRate: sellerRate
      }
  </code></pre>
  
  <p>Then it's sent via AJAX:</p>
  
  <pre><code>function CreateLottery(lottery) {
  $.ajax({
      type: 'POST',
      url: 'default.aspx/Create',
      data: lottery,
      contentType: 'application/json; charset=utf-8',
      dataType: 'json',
      success: function (data, status) {
          alert(status)
      },
      error: alert("error!")
   });
  }
  </code></pre>
  
  <p>The C# code-behind (i have breakpoint and it never reaches here):</p>
  
  <pre><code>    [WebMethod]
      public static object Create(Lottery lottery)
      {
          return new
          {
              foo = "bar",
          };
      }
      public class Lottery
      {
          public decimal TotalValue { get; set; }
          public decimal Players { get; set; }
          public decimal TicketPrice { get; set; }
          public decimal FirstPrize { get; set; }
          public decimal MyComission { get; set; }
          public decimal MyRate { get; set; }
          public decimal SellerComission { get; set; }
          public decimal SellerRate { get; set; }
      }
  </code></pre>
  
  <p>Why i get always the "error!" alert?</p>