When I'm uploading a file I make an AJAX request:
$(function () {
$.ajax({
async: true,
url: "../public/currentfile",
dataType: 'json',
method:'get',
success: function(data) {
console.log(data);
var created_at = data['created_at'];
var filesize = data['filesize'];
var filename = data['filename'];
var fileid = data['fileid'];
$("#results .toBeSelected").prepend("<tr class='tabledata'><td>" + fileid + "</td><td>" + filename + "</td><td>" + filesize + "</td><td>" + created_at + "</td></tr>");
}
});
});
I get the filesize, filename and so on and pass them to the browser. Everything's ok when I upload a single file. But when I upload more than 5 files at once, some of the responses are duplicate.
What is wrong? Is this a wrong practice?