0
var text={"hello.txt":"Hello World!","bye.txt":"Goodbye Cruel World!"};
app.get('/files/:name',function(req,res){
res.set("Content-Type","text/plain");
res.send(text[req.params.name]);
});
,这是我的客户端AJAX调用
$.ajax({
type: verb || 'GET',
dataType: "text",
url: url,
data: data,
contentType : 'text/plain',
success: function() { $('div#callForm button').removeAttr('disabled'); },
error: alert
});
但是没有文件返回下载。
有人能指出我正确的方向吗?
我看到生病添加这块到我的代码,看看是否得到一个文件后下载。现在标记正确谢谢 –