title: How do I pass decimal values to controller using Ajax?
body: <p>I have a number input, and when the user enters a number, it will be sent from the view to the controller using Ajax. Everything works fine, but when the user enters decimal numbers, I get binding errors (1,1 or 1.2 etc). I want the user to be able to use decimal numbers. </p>
  
  <p>This is the relevant View code:</p>
  
  <pre><code>var postdata = {x: &lt;number input value&gt;};
  $.ajax({url: url, type: "POST", data: postdata, async: false})
  </code></pre>
  
  <p>This is the Controller function:</p>
  
  <pre><code>[HttpPost]
  public ActionResult MyFunction(decimal x) 
  {
    return Json(new {success = true, JsonRequestBehavior.AllowGet});
  }
  </code></pre>