dra87370 2016-04-13 09:50 采纳率: 100%
浏览 44

jquery文件下载插件不起作用

I am using this plugin to make it possible to download files or at least I try to but it won't work.

I put the mentioned cookie in my index.php at top position like this:

header('Set-Cookie: fileDownload=true; path=/');

The cookie is set, I can see that in the site information. My js code on the current site looks like this:

$('.js--download').on('click', function(){
    var target = $(this).attr('href');
    $.fileDownload(target)
    .done(function () { alert('File download a success!'); })
    .fail(function () { alert('File download failed!'); });
    return false; //this is critical to stop the click event which will trigger a normal file download!
});

The problem is that the .done function is fired but the download didn't start. I also wonder why I can see now request send by the network in my browser inspect tool. When it's really an ajax call I should see it there.

So, someone with an idea?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?