我想使用表单数据发送动态文本框和文件上传值 示例如variablename =“string1 = string1.jpg + string2 = string2.jpg + string3 = string3.jpg”
的javascript
$("#addRow").click(function () {
for(var i=0;i<1;i++){
$("#dynamicadd").append("<div class='row'><div class='col-md-8'><div class='form-group'><input type='text' class='form-control' id='field-3"+ counter +"' placeholder=''></div></div><div class='col-md-4'><div class='form-group'><div class='fileUpload btn btn-primary waves-effect waves-light' style='margin-top:0;'><span>Upload</span><input type='file' name='uploadBtn' id='uploadBtn' class='upload'/></div></div></div></div>");
}
counter++;
});
答案 0 :(得分:0)
我假设你的dynamicadd在表单元素中 使用下面的代码提交带有ajax
的文件元素的表单jQuery.ajax({
dataType: "json",
type: "POST",
url: your url here,
processData: false,
contentType: false,
data: new FormData(jQuery('#your-form-id')[0]),
success: function(response) {
}
});