[英]Export CSV with Javascript and display progress bar
Is there a way to display a progress bar while a CSV file is being generated and served up via ajax?有没有办法在生成 CSV 文件并通过 ajax 提供时显示进度条? The CSV file takes a while to generate due to the database, and need a loader on the screen and hide it when it is done.
由于数据库的原因,CSV 文件需要一段时间才能生成,并且需要在屏幕上加载一个加载程序并在完成后将其隐藏。 I would like this to be ajax or stay on the same page if necessary.
我希望这是 ajax 或在必要时留在同一页面上。 Right now I am doing this below, but I can't tell when the file is done downloading to stop the progress.
现在我正在下面执行此操作,但我无法确定文件何时完成下载以停止进度。
var iframe = document.createElement("iframe");
iframe.src = (value.url);
iframe.style.display = "none";
document.body.appendChild(iframe);
If I understand your situation correctly you are generating a file on the server side when you receive a request, saving it to disk and then serving it up from there.如果我正确理解您的情况,您将在收到请求时在服务器端生成一个文件,将其保存到磁盘,然后从那里提供。 If that is what you are doing you have two options:
如果那是您正在做的事情,您有两种选择:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.