JavaScript使用Nodejs模板引擎EJS

HTML文件里加入下面一段代码(下载地址:http://www.embeddedjs.com/):

<script type="text/javascript" src="ejs_production.js"></script>

Syntax

// load a template file, then render it with data
html = new EJS({url: '/template.ejs'}).render(data)

// update element 'todo' with the result of a  
// template rendered with data from a JSON request
new EJS({url:'/todo.ejs'}).update('todo','/todo.json')

posted @ 2017-07-14 01:41  忘忧人  阅读(172)  评论(0编辑  收藏  举报