Passing a javascript variable to Session

Asked

Viewed 384 times

3

I wonder, how do I send a value I have in javascript to a @Session. in case it would be more or less 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 turn the error page in javascript. how could I do ?

  • What is the purpose of this?

  • I needed to take it to the controller, but I already found another solution. Thanks

1 answer

2

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

  • I got here at 45 of the second time passing by parameter on the link. Tomorrow I answer my own question kk Thanks bro good luck to us

  • Ah, there you go, nice ;)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.