Actually I have the data in @html.dropdown("data"),"the data is having the all cities " ,now I wanna call the controller function with the OnChange event of this dropdown.Can u plz help to do this ...thanks in advance.
What I have tried:
View:
ViewBag.Title = "cities";
}
@using (Html.BeginForm("cities", "Home", FormMethod.Get))
{
@Html.DropDownList("cities", null, new { @onchange = "location = this.value;" })
}
Controller:
ublic class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
//
I wanna call this function with onchange event
public List<Tuple<string, int, int>>gethillstatoins (List<string> hillstations)
{
}
Script:
function gethillstatoins() {
jQuery.ajax({
url: '@Url.Action("Action Method Name", "Controller Name")',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({ data: data2 }),
success: function (result) { }
});