I have the button on my page:
<input type="button" class="btn btn-default" value="BMW" id="sendBMW"/>
I try to send Post request to controller using Jquery:
<script type="text/javascript">
$("#sendBMW").button().click(function () {
$.post('/Home/GetCarsByCriteria', 'bmw');
})
</script>
Here my controller:
[HttpPost]
public IEnumerable<Car> GetCarsByCriteria(string param) {
var cars = db.Cars.Where(x=> x.Seria == param).ToList();
return cars;
}
I tried to add [FromBody] attribute in to Controller, but brek-point doesn't work. Does somebody to know how i can solve it ?
