all I want to pass one javascript variable to Controller from MVC View from Form. This is my own selected text variable which I want to pass to controller so that I can retrieve and save in Database.Any help will be appreciated I am sharing the code which I want
View -->I am getting selected text value which I want to pass to controller
$(document).ready(function () {
$("#stateID").change(function () {
var state= $('#stateID :selected').text();
getCities(state);
});
});
Now I want to pass this state variable to controller from an mvc form
@using (Html.BeginForm("Register", "Registration", FormMethod.Post))
{
<input type="submit" value="Save" style="text-align:center" />
}
Now, this is my controller Code which I want to retrieve
[HttpPost]
public ActionResult Register(RegisterModel Regmodel)
{
if (ModelState.IsValid)
{
return View();
}
}
Thanks @Rondles My issue is resolved now and thank you guys for ur quick resonse