gpt4 book ai didi

javascript - JQuery fileDownload 失败时出现错误

转载 作者:太空宇宙 更新时间:2023-11-04 15:53:33 24 4
gpt4 key购买 nike

这就是我所拥有的:

  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.fileDownload/1.4.2/jquery.fileDownload.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(document).on("click", "a.fileDownloadSimpleRichExperience", function () {
$.fileDownload($(this).prop('href'))
.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
});
});
</script>

必须配合使用

<a href="" class="fileDownloadSimpleRichExperience" href="http://speed.hetzner.de/100MB.bin">AAAA</a>

由于某种原因,下载失败,我收到相关错误:文件下载错误!。我希望我在 python 代码中使用值为 True 的 cookie fileDownload 解决了该部分,但不确定。

如何查看下载失败的原因?我想一定和这个有关:https://github.com/johnculviner/jquery.fileDownload/blob/master/src/Scripts/jquery.fileDownload.js#L226

最佳答案

这是因为双 href属性。 <a href="" class="fileDownloadSimpleRichExperience" href="http://speed.hetzner.de/100MB.bin">AAAA</a>

第一个href有优先权。

关于javascript - JQuery fileDownload 失败时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42901150/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com