Home >Web Front-end >JS Tutorial >Method to add additional parameters to jquery's ajaxfileupload_jquery

Method to add additional parameters to jquery's ajaxfileupload_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 16:57:181221browse

How to say it directly:

Copy code The code is as follows:

$.ajaxFileUpload({
data:{" a":123,"b":456};//Additional parameters, json format
});


Then modify the two functions in the ajaxFileUpload.js file. In fact, It’s just a function (add new parameters to the function)

First place:

Copy code The code is as follows:

createUploadForm: function(id , fileElementId,data){} is greater than line 26.

Then add the following code to the function body:

Copy the code The code is as follows:

if (data) {
for (var i in data) {
$(' }
}

Code function: Process json data and add input of type='hidden' to the form

Second place:

Copy code The code is as follows:

ajaxFileUpload(){}
var form = jQuery.createUploadForm(id, s.fileElementId,s.data); Just modify this line, just add one more parameter.

The modification here is actually about the parameters of the function call.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn