新闻列表和查看代码:
exports.list = (req,res,next) => { let sql = "select * from exihibition"; util.getConn().queryAsync(sql).then((result) => { res.render("admin/exihibitionlist.html",{exihibitions:result}); }).catch((err) => { res.send("error"); }); } exports.show = (req,res,next) => { let sql = "select * from exihibition where id = ?"; util.getConn().queryAsync(sql,这里要怎么写才能取到该条新闻的id值).then((result) => { res.render("admin/exihibitionshow.html",{exihibitions:result}); }).catch((err) => { res.send("error"); }); } 数据传输代码:
var exihibitionlist = {
url : "/exihibition/list", class : "page", render : function(){ return $_ajax({ url : "/exihibition/list", type : "get" }); }
}
var exihibitionshow = {
url : "/exihibition/show", class : "page", render : function(){ return $_ajax({ url : "/exihibition/show", type : "get" }); }
}
视图
业精于勤,荒于嬉;行成于思,毁于随。