Can a js script get a variable written in a EJS context/page within the same file

前端 未结 4 1004
庸人自扰
庸人自扰 2020-11-30 07:09

As I wrote in the title, I\'d like to get a value from a variable written into a ejs page/file, from a javascript file within the same page

EJS:

<         


        
4条回答
  •  -上瘾入骨i
    2020-11-30 07:35

    Solution with a string

    <% var test =myString; %> // variable created by ejs
              
    Don't forget the quotes around "<%= test %>"

提交回复
热议问题