萌新求教:
//执行查询
connection.query('select * from newslist where sort=?', [sort], function (err, rs) {
if (err) {
console.log('[query] - :' + err);
return;
}
console.log('--------------------------result----------------------');
for (var i = 0; i < rs.length; i++) {
console.log('The solution is: ', rs[i]);
}
console.log('--------------------------result----------------------');
});
怎么把上面操作获取到的结果rs 传给前端(是用AJAX写的,上面代码仅仅是console.log可以在cmd控制台打出来)
If it is passed to the front end through ajax, the relevant interface needs to be defined for the front end to access. Then put the operation of querying data in the interface. You can refer to my small project
https://github.com/ermu592275...