title: asp.net pagemethod call, using jquery, returns error status 500
body: <p>I haven't been able to find any good solutions to this issue, so I need som help.</p>
  
  <p>I have a PageMethod that I need to call with jquery. The client code looks like this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(function () {
          $("#MainContent_ddl_antal").change(function () {
              var selectedvalue = $(this).val();
              //alert(selectedvalue);
              $.ajax({
                  type: "POST",
                  url: "betaling.aspx/GetTotPrice",
                  data: "{'antal':" + selectedvalue + "}",
  
                  //data: JSON.stringify({ antal: selectedvalue }),
                  contentType: "application/json; charset=utf-8",
                  dataType: "json",
                  success: function (msg) {
                      // Set label text to method's return.
                      alert(msg.d);
                      $('#&lt;%= lbl_totpris.ClientID %&gt;').html(msg.d);
                  },
                  error: function (error) {
                      alert(error.status);
                  }
              });
  
          });
      });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>and the codebehind PageMethod looks like this:</p>
  
  <pre><code>[WebMethod]
  public static double GetTotPrice(int antal)
  {
      double totpris = 0;
      Product _product = Product.GetProductByDate(DateTime.Today);
  
      if (_product != null)
      {
          totpris = _product.ProductNuPris * antal;
      }
      return totpris;
  }
  </code></pre>
  
  <p>The call returns an error 500. I can't see the reason for this.</p>