Ajax Download using valums plugin to load ajax inside a form

I just stumbled upon this ajax download plugin and I want to use it inside the form, as shown in sample demo page 3 . For some reason, I can't get it to work. I am not sure which parameters are included in the function. For example, here is my sample code.

$(document).ready(function(){

        var upload = new AjaxUpload('property_i',
        {
        action: 'submitproperty.php',
        autoSubmit: false,
        onSubmit : function(file , extension){
        return false;
        }
        });

        var upload_data = upload.setData({
        'propertytype':'propertytype'
        });

       });

Now the identifier used in the AjaxUpload function should be the identifier of the form or the whole form. Just like I can use the setData method. Any suggestions or links would be very helpful. Thanks

+3
source share
3 answers

I got it to work with the following code:

new AjaxUpload('#uploader_button', {
    action: 'filename.ashx',
    autoSubmit: true,
    onSubmit: function(file, ext) {
        // --- stuff here

        // --- add postdata parameters
        this.setData({ id: 1, title: docTitle.val() }); 
    },
    onComplete: function(file, response) {
        // --- stuff here too
    }
});

var, onSubmit. , , , , . autoSubmit: false, ...

+2

autoSubmit: false - :

var uploader;
var uploadFile;

AjaxUpload (...

            onChange: function(file, response){
                    uploader = this;
                    uploadFile = file;
            },

:

  uploader.setData({session: session});
  uploader.submit();

,

+1

I use uploadify and is very useful. http://www.uploadify.com/

0
source

Source: https://habr.com/ru/post/1731981/


All Articles