Mix Razor and Javascript code

前端 未结 7 1816
情歌与酒
情歌与酒 2020-11-22 16:21

I\'m pretty confused with how to mix razor and js. This is the current function I am stuck with:



        
相关标签:
7条回答
  • 2020-11-22 17:05

    Wrap your Razor code in @{ } when inside JS script and be aware of using just @ Sometimes it doesn't work:

    function hideSurveyReminder() {
           @Session["_isSurveyPassed"] = true;
        }
    

    This will produce

    function hideSurveyReminder() {
           False = true;
        }
    

    in browser =(

    0 讨论(0)
提交回复
热议问题