Express的版本是4.16.4
我想从以下位置下载NodeJs:
list.on("click", "a[data-facture]", function () {
var facture = $(this).data("facture");
$.ajax({
url: "/track/vehicule/downloadfacturemaintenance",
data: { "facture": facture },
type: "POST",
success: function (data, status, xhr) {},
error: function (xhr, status, error) {}
});
});
router.post("/downloadfacturemaintenance", function (req, res) {
var facture = req.body.facture;
var fichier = facture.substring(facture.lastIndexOf("/") + 1);
var ext = fichier.substring(fichier.lastIndexOf("."));
fichier = fichier.substring(0, fichier.indexOf("_"));
res.download(facture, fichier.concat(ext));
});
在运行时,当我单击链接然后没有下载开始!那么我的代码有什么问题?