1

I'm using jquery file upload plugin. I added an extra button to tell the server to finalize everything, this is suppose to send an extra parameter as below:

$('.btn-finalize').click(function(){
    $('#fileupload').fileupload({
        dataType:'json',
        formData:{name:'finalize',value:'1'},
        url: 'server/php/'
       });
});

This click handler is called, but no request is getting sent. why?

Fractaliste
  • 5,777
  • 11
  • 42
  • 86
user121196
  • 30,032
  • 57
  • 148
  • 198

1 Answers1

0

The documentation advice to inverse click and autoupload handlers.

$('#fileupload').fileupload({
    autoUpload: false,
    formData: {
        name: 'finalize',
        value: '1'
    },
    add: function (e, data) {
        $('.btn-finalize').click(function () {
            data.submit();
        })
    },
    done: function (e, data) {    
        console.log(data.formData.name); // Show "finalize" in the console
    }
});

A testing fiddle

Fractaliste
  • 5,777
  • 11
  • 42
  • 86