So I am using the Bluimp Jquery File Upload plugin to upload files to S3. Everything works fine, except that, once I have uploaded 1 file, I cannot upload another. The element is still present on the page, but it seems like the event listener has stopped working perhaps. Essentially, I would just like to reload one div (.activity-post).
I have tried the following:
$(".activity-post").load();
$(".activity-post").load(window.location.href + ".activity-post");
document.getElementById('#inputfile').reset(); //also doesnt work.
This is the loadActivity() function:
function loadActivity() {
var competitionId = $("body").attr("data-competitionId");
var url = "activity_api.php?competitionId=" + competitionId;
$.get(url, function(data) {
$("#activityspot").html(data);
});
}
Here is the script:
$('#inputfile').fileupload({
url: 'upload.php?competitionId=<?php echo $_GET['competitionId']; ?>',
sequentialUploads : true,
dataType: 'text',
progressall: function (e, data) {
$(".loader").show();
},
done: function (e, data) {
loadActivity();
console.log("updating activity feed");
//reset element here.
}
});