Passing a variable from javascript to session

3

I would like to know how do I submit a value that I have in javascript for an @session. in the case it would look something like this:

I have a variable:

  

var id = $ (Person) .val ();

This ID wanted to use in a session variable, but I tried to do so:

  

@Session ["Person"] = id;

But when I run the error page in javascript. how could I do it?

    
asked by anonymous 25.11.2016 / 04:42

1 answer

2

Why not send this id pro controller using json and put it in a viewbag, and use it in the view?

    
25.11.2016 / 05:36