开发者

How to call a method in its onSubmit event?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜