Data passing from Javascript to MVC controller -


I have to pass data from javascript to the controller in the MVC app. How can this be achieved? I want to set up a ViewModel property and then read it in that controller. My Javascript:

  function DoInfo @ (i.ToString ()) () {$ ("# Selected Sessions"). Val ($ ("# sessionid @ (i.ToString ())") .val ()); Warning ($ ("# sessionid @ (i.ToString ())") Val ().); $ ("# PageController") Val (70). $ ("#FormID") presented (). }   

I get a warning with the right session, but when I read it in the controller view model it is empty. Selected session but PageController is set to Reality, so I think I can select the same session.

  if (viewModel.PageController == 70) {pass = new PassingData (); Pass.personid = TSSessionService.ReadPersonId (viewModel. Selected session); TempData ["pass"] = pass; Return Redirect Action ("Index", "Info"); }   

Any clues?

Add the selected session as your view to a field (perhaps a hidden field if you do not have it

  & lt;% = Html.HiddenFor (model)  

On your view, inside the submission of the form, = & Gt; Model.SelectedSession)%>

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -