How to get asp.net Session value in jquery method?

前端 未结 6 1473
迷失自我
迷失自我 2020-12-13 16:11

I want to access a Session value in jquery method in the ASP.NET MVC view page. See the below code,

$(\'input[type=text],select,input[type=checkbox],input[ty         


        
6条回答
  •  北海茫月
    2020-12-13 16:34

    Easy! when you know how:

    @Html.Encode(Session("classificationTitle"))

    ...and in the .js file:

    var classificationTitle = document.getElementById('classificationTitle').innerHTML;
    

    sorry - I can't post the full html as this site strips out angle brackets :(

提交回复
热议问题