简体   繁体   English

刷新上一页

[英]Refresh previous page

I have website that produces a csv to be downloaded after some user input. 我有一个网站,生成一些用户输入后即可下载的csv。 http://splice.cmi.arizona.edu/splice_file_upload/fileupload.php http://splice.cmi.arizona.edu/splice_file_upload/fileupload.php

The page works in giving me a csv, the problem I do have is that after downloading the csv, I want the original page to refresh (or at least get rid of the text that a file has been uploaded). 该页面可以为我提供一个csv,但我确实遇到的问题是,在下载csv之后,我希望刷新原始页面(或至少摆脱已上传文件的文本)。

I tried calling onclick on the submit button to run some javascript, but that doesn't seem to be working. 我尝试在提交按钮上调用onclick来运行一些javascript,但这似乎不起作用。

What is the best way to do this? 做这个的最好方式是什么?

Thanks 谢谢

Have you tried 你有没有尝试过

document.location.href = 'http://splice.cmi.arizona.edu/splice_file_upload/fileupload.php';

after the submit event? 提交事件之后?

Hmz, try this code out: 嗯,试试下面的代码:

JS JS

window.onload=function(){document.forms['analyses'].lastChild.previousSibling.onclick=function(){setTimeout(function(){location.reload(true);},1000);return true;};};

Just add this js anywhere in the page :-? 只需在页面中的任何地方添加此js:-? should work. 应该管用。 If not... post errors. 如果没有,请发布错误。

PS This is a horrible way of making the page refresh after you click submit. PS:单击提交后,这是一种使页面刷新的可怕方法。

The simplest solution would actually be to clear that zone after you click submit. 最简单的解决方案实际上是单击提交后清除该区域。

In javascript, you can use 在javascript中,您可以使用

window.location="your current page to reopen e.g. fileupload.php"

or in PHP, 或在PHP中,

<?php header("Location: fileupload.php");?>

In general, after completing download action, simply redirect to the same page. 通常,完成下载操作后,只需重定向到同一页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM