【发布时间】:2018-01-12 09:32:47
【问题描述】:
我想在从 API 获取数据后渲染一个文件。
代码
$(document).ready(function() {
$(document).delegate( "#editUser", "click", function() {
var userId = $(this).data('id');
$.post("/userProfile",{"userId":userId},function(data, status){
console.log(data); //gets data here
//how to render ejs file here with the above data?
});
});
ejs 文件: (sample.ejs)
<% include header.html %>
<strong>Sample ejs</strong>
<ul>
<li><%= data.name %> says: <%= data.message %></li>
</ul>
<% include footer.html %>
我该如何解决这个问题?
【问题讨论】:
标签: javascript jquery node.js express ejs