当我加载我的应用程序时,我使用这样的路由系统:
router.get('/home', verifyAuth, function (req, res) {
axios.get('http://localhost:3000/api/posts')
.then(resposta => {
res.render('home', { info: resposta.data })
})
.catch(erro => {
res.render('error', { error: erro, message: 'Error' })
})
});
但是在我的html中,我有一些触发此功能的按钮
var array= new Array()
function myFunc(test){
array.push(test)
$.ajax({
url: "http://localhost:3000/api/posts/filter/",
contentType:"application/json",
type: "POST",
data: JSON.stringify({myArray: array}),
dataType: "json",
success: function(data){
//res.render('home', { info: data })
}
});
}
我该如何做像ajax的success
中的内容?