简体   繁体   中英

jQuery Upload File Plugin - how to reload page after upload?

I am using this plugin: http://hayageek.com/docs/jquery-upload-file.php on my site.

It is working nice, but I need to reload page after successful upload. There is some Callback afterUploadAll which maybe can do it, but I don´t know how to implement it.

Here is my code, how can I add it to that?:

<h1>Header</h1>
<div class="wrapper">
<div id="uploader">Upload</div>
</div>

<script>
$(document).ready(function()
{
    $("#uploader").uploadFile({
    url:"upload.php",
    fileName:"myfile",
    showDone:true,
    maxFileSize: 20971520,
    showFileCounter: false,
    }); 
</script>
<script>
$(document).ready(function()
{
$("#uploader").uploadFile({
url:"upload.php",
fileName:"myfile",
showDone:true,
maxFileSize: 20971520,
showFileCounter: false,
afterUploadAll: function(obj) {
    window.location = 'YOUR URL HERE';
}
}); 

OR

 <script>
   $(document).ready(function()
   {
  $("#uploader").uploadFile({
url:"upload.php",
fileName:"myfile",
showDone:true,
maxFileSize: 20971520,
showFileCounter: false,
afterUploadAll: function(obj) {
    location.reload();
}
}); 

try:

<script>
$(document).ready(function()
{
    $("#uploader").uploadFile({
    url:"upload.php",
    fileName:"myfile",
    showDone:true,
    maxFileSize: 20971520,
    showFileCounter: false,
    afterUploadAll: function(obj) {
        window.location = 'http://www.example.de';
    }
    }); 
</script>

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