开发者

How to call a method in its onSubmit event?

开发者 https://www.devze.com 2023-04-06 13:41 出处:网络
I try to implement file uploader script from this Github project and I need to set some additional params from the form before submitting the upload.

I try to implement file uploader script from this Github project and I need to set some additional params from the form before submitting the upload.

According to the documentation it's being set like that:

uploader.setParams({
   anotherP开发者_StackOverflowaram: 'value' 
});

How can I set these parameters in the onSubmit event? Something like:

var uploader = new qq.FileUploader({
  onSubmit: function() {
    // <- I want to set the params here
  }
});

I tried self.setParams() and this.setParams() but no luck. I'm not that advanced in javascript so I would be thankful for any help.


You can use the same code you posted. "uploader" will exist when onSubmit is called

var uploader = new qq.FileUploader({
    onSubmit: function() {
        uploader.setParams({
            anotherParam: 'value' 
        });
    }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消