jQuery autocomplete pass null paramter to the controller in ASP.NET MVC 2
- by myaesubi
I'm using jQuery autocomplete plugin from jQuery website
calling the controller url which return json in return. The problem is the parameter sent to the controller is always null.
Here is the in-browser jQuery code for the autocomplete:
$(document).ready(function() {
var url = "/Building/GetMatchedCities";
$("#City").autocomplete(url);
});
and here is the ASPNET MVC controller signature in C#:
public JsonResult GetMatchedCities(string city)
{
..
return this.Json(query, JsonRequestBehavior.AllowGet);
}
Thanks in advance,
Mohammad