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 retr
You could set up a hidden field in your form for the state (I assume state is a property on your RegisterModel?) and in your stateID.change function have it assigned the value to the hidden field for it to be passed on submit.
e.g:
Hidden field in the form can be set up with (inside your begin form code):
@Html.HiddenFor(model => model.StateID, new { id = hiddenStateID" })
Then your jQuery would be (untested, this is more pseduo code to give you the idea):
$(document).ready(function ()
{
$("#stateID").change(function (){
var state= $('#stateID :selected').text();
getCities(state);
$("#hiddenStateId").val(state);
});
});