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.
This is the relevant View code:
var postdata = {x: <number input value>};
$.ajax({url: url, type: "POST", data: postdata, async: false})
This is the Controller function:
[HttpPost]
public ActionResult MyFunction(decimal x)
{
return Json(new {success = true, JsonRequestBehavior.AllowGet});
}