简体   繁体   中英

Refresh previous page

I have website that produces a csv to be downloaded after some user input. 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).

I tried calling onclick on the submit button to run some javascript, but that doesn't seem to be working.

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

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 :-? should work. If not... post errors.

PS This is a horrible way of making the page refresh after you click submit.

The simplest solution would actually be to clear that zone after you click submit.

In javascript, you can use

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

or in PHP,

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

In general, after completing download action, simply redirect to the same page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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