jQuery file upload callback

https://github.com/blueimp/jQuery-File-Upload/wiki/Options#callback-options

https://github.com/blueimp/jQuery-File-Upload/wiki/Options#processing-callback-options

Such an approach has the following problems can cause jquery.fileupload-process.js the options [add] can not be triggered

https://github.com/blueimp/jQuery-File-Upload/blob/master/js/jquery.fileupload-process.js#L54

$(function () {
    $('#fileupload').fileupload({
        dataType: 'json',
        add: function (e, data) {
            data.context = $('<button/>').text('Upload')
                .appendTo(document.body)
                .click(function () {
                    data.context = $('<p/>').text('Uploading...').replaceAll($(this));
                    data.submit();
                });
        },
        done: function (e, data) {
            data.context.text('Upload finished.');
        }
    });
});

 

Guess you like

Origin www.cnblogs.com/chucklu/p/11122732.html