Reputation: 550
I am using the Plupload plugin to upload multiple files. I am binding the FileUploaded event to the uploader to perform more actions once the file is uploaded. Here is where I am binding the event.
uploader.bind('FileUploaded', function(up, file, response) {
var p = new Object;
p.language = $.trim(currentLanguageSelected);
p.contentType = $.trim(contentType)
p.description = $.trim($("#subtitle").val());
p.path = response.response + '/' + file.name;
p.title = file.name;
$.ajax({type: 'POST',
url: '/admin/content/save/saveBinaryContent.xqy'
data: p,
success: function(data) {
$('.preview').html('success');
}
});
});
Since multiple files can be uploaded at once, this event will be called for each file. The problem is, after the first file gets it's ajax request, the page refreshes and the other files don't get uploaded. I've tried the common solutions i've found here and through google to prevent page refresh, but none seem to be workable for my issue. I remove the ajax request and everything uploads fine for each file, but I also need the additional ajax processing for each file.
EDIT: So stupid! another one of our JS files had a jQuery .ajaxSetup function that was messing it all up. So after a day of frustration, it is finally working.
Upvotes: 0
Views: 741
Reputation: 15338
success: function(data) {
$('.preview').html('success');
return false;
}
Upvotes: 1