我的代码如下,请问可以在route里直接获取url的id值吗? 如果不行,应该怎么做 求助!!!!! html中:
<a href="#/admin/sharepass/<%=share.id%>">审核
js中:
var adminsharepass = {
url:"/admin/sharepass/:id",
class:"adminsharepass",
render: function (){
return $._ajax({
url:"/admin/sharepass/:id",
type:"get"
});
}
route中:
router.get('/sharepass/:id', function(req, res, next) {
let sql = "select*from share WHERE id=?";
util.getConn().queryAsync(sql,[req.param('id')]).then((result)=>{
res.render("admin/adminsharepass.html",{share:result});
}).catch((err)=>{
res.send("error");
})
});