I am trying to call an MVC method via Ajax. The code on client is as follow:
var serviceUrl = "/Regions/GetRegionPoints";
$.get(serviceUrl, { id:region_id}, function (data) { alert("Data Loaded: " + data); });
and my MVC method is:
public JsonResult GetRegionPoints(string id)
{
var model = GetRegionPoints();
if (model.Any())
{
return new JsonResult(){Data = model};
}
return new JsonResult();
}
I can see that the client calls Ajax and then my action is called, but there is no success and there is no data on client ( alert("data loaded") ) is not called.
What is the problem?