Thursday, December 20, 2018

Sessions, objects, and Jquery

I was wondering if there's a way to access session object properties through jquery to be simple.

Such as:

FooModel fooModel = new FooModel{ foo =bar, bar = foo}; Session['fooModel'] = fooModel; 

And have a session with the fooModel object, which I can easily get the properties in C#

fooModel.foo; 

, but I can't get them in JQuery as easily, atm I have a session for each property but there has to be a better way to get each one by itself right?

Atm it looks a little like (every property has a session, rather than one session object)

var prop= '@Session['foo']'; 

Is there not a way to do something like :

var objProp = "@Session['fooModel']"; //objProp.foo; //var objProp = "@Session['fooModel']; 

​

Sessions, objects, and Jquery Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team