passing an array from EJS to Javascript

前端 未结 5 939
隐瞒了意图╮
隐瞒了意图╮ 2021-01-20 23:48

I am trying to passe an array from ejs to JavaScript. I can get to the values inside ejs but not from JavaScript. all the time i get undefined because the contents of the variab

5条回答
  •  不要未来只要你来
    2021-01-21 00:16

    i found a solution it's work, but i don't know if there is other ways to do it. i change

    var test = '<%- level_tab %>';
    

    by this loop,

    <% for(var j=0; j
                level_tab.push('<%- level_tab[j]%>');
    <%}%>
    

提交回复
热议问题