How to use scriptlet inside javascript

后端 未结 4 1675
半阙折子戏
半阙折子戏 2020-11-30 15:23

Can someone test this example and share the results? http://timothypowell.net/blog/?p=23
When I do:

var myVar = \'<% request.getContextPath(); %>\'         


        
4条回答
  •  悲&欢浪女
    2020-11-30 15:46

    var myVar = '<%=request.getContextPath() %>';
    alert(myVar);
    

    You forgot to out put = before request and remove ; after getContextPath()

提交回复
热议问题