title: How to Pass javascript variable to Controller in MVC from View
body: <p>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 </p>
  
  <p>View -->I am getting selected text value which I want to pass to controller</p>
  
  <pre><code>$(document).ready(function () { 
      $("#stateID").change(function () {
           var state= $('#stateID :selected').text();
           getCities(state);
      });
  });
  </code></pre>
  
  <p>Now I want to pass this state variable to controller from an mvc form</p>
  
  <pre><code>@using (Html.BeginForm("Register", "Registration", FormMethod.Post))
  {
      &lt;input type="submit" value="Save" style="text-align:center"  /&gt;
  }
  </code></pre>
  
  <p>Now, this is my controller Code which I want to retrieve</p>
  
  <pre><code>[HttpPost]
  public ActionResult Register(RegisterModel Regmodel)
  {
      if (ModelState.IsValid)
      {
          return View();
      }
  }
  </code></pre>
  
  <p>Thanks @Rondles My issue is resolved now and thank you guys for ur quick resonse   </p>