Properly pass file upload response to success()

This commit is contained in:
Brian Federle 2015-01-06 15:16:25 -08:00
parent ca824cb7fb
commit ed903e3589
2 changed files with 8 additions and 4 deletions

View File

@ -110,6 +110,9 @@
title: 'label.action.register.template',
docID: 'helpNetworkOfferingName',
preFilter: cloudStack.preFilter.createTemplate,
// Handles POST to upload server
// -- standard action handler won't be called until success() callback
fileUpload: {
action: function(args) {
var fileData = args.fileData;
@ -121,9 +124,10 @@
cache: false,
dataType: 'json',
processData: false, // Don't process the files
contentType: false, // Set content type to false as jQuery will tell the server its a query string request
contentType: false, // jQuery will tell the server this is a query string request
success: function(uploadData, textStatus, jqXHR) {
args.response.succes();
// Files uploaded successfully; proceed to handle rest of action
args.response.succes({ data: uploadData });
},
error: function(error) {
args.response.error('Error uploading files');

View File

@ -693,12 +693,12 @@
context: args.context,
uploadData: formData,
response: {
success: function() {
success: function(successArgs) {
$form.find('.loading-overlay').remove();
$form.data('files', null);
args.after({
data: $.extend(data, { uploadData: uploadData }),
data: $.extend(data, { uploadData: successArgs.data }),
ref: args.ref, // For backwards compatibility; use context
context: args.context,
$form: $form