I have a method in that I am having a date picker control, on that selection I want to bind the data to the same view.
So, I wanted to call non action method for onchange
event of date using ajax()
, but could not do it.
Can anyone help me with this?
[HttpGet]
public ActionResult GetCall()
{
return View();
}
[NonAction]
public JsonResult GetData(int currentMonth)
{
var data= object.datacall(currentMonth);
return Json(data, JsonRequestBehavior.AllowGet);
}
ajax call:-
$.ajax({
url: 'GetData',
method: 'GET',
data: { 'currentMonth': date.getMonth()},
success: function (data) { },
error: function (response) { }
});