2

I have a session in ASP, it's object. Now, I want read some value of object in client , I known Session live in Server , at client only read it.

enter image description here

 var obj = UserModBus.Login(user_name, pass_word);
        if (obj != null)
        {
            HttpContext.Current.Session["OBJ"] = obj;
        }

In my page using javascript

 <script type="text/javascript" charset="utf-8">
    $(document).ready(function () {        
var full_name = '((QLNT.DATA.USER_MOD) Session["OBJ"]).FULL_NAME%>';
var birth_day = '((QLNT.DATA.USER_MOD) Session["OBJ"]).BIRTH_DAY%>';
        window.onload = function () {
            alert(full_name + birth_day);
        }
    });
</script>

But it's not working. Can you give me some advice to solve it?

Thank you guys.

1 Answer 1

3

Is it because you are missing the <%=?

...
var full_name = '<%=((QLNT.DATA.USER_MOD) Session["OBJ"]).FULL_NAME%>';
var birth_day = '<%=((QLNT.DATA.USER_MOD) Session["OBJ"]).BIRTH_DAY%>';
...
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.