我正在尝试从表单中收集所有数据:
我用表单创建剧透:
var workerSpoiler = '\
<form id="worker_edit_'+this.id+'"\
<div class="form-inner-wrapper">\
<div class="block flex form-input-wrapper">\
<input type="text" data-id="gear-'+this.id+'" required name="name" value="'+this.name+'" placeholder="Фио" disabled>\
<label for="pas-scan" class="file-btn">Скан паспорта</label>\
<input id="pas-scan" type="file" data-id="gear-'+this.id+'" name="pas-scan" placeholder="Скан паспорта">\
</div>\
<div class="block form-input-wrapper">\
<textarea name="bibliography" data-id="gear-'+this.id+'" placeholder="Биография" disabled>'+this.bibliography+'</textarea>\
</div>\
<div class="block form-input-wrapper">\
<textarea name="history" data-id="gear-'+this.id+'" placeholder="История" disabled>'+this.history+'</textarea>\
</div>\
<div class="block form-input-wrapper">\
<input type="text" data-id="gear-'+this.id+'" name="salary" value="'+this.salary+'" placeholder="З/П" disabled>\
</div>\
<a href="javascript:delete_worker('+this.id+');"><i class="fa fa-trash-o" aria-hidden="true"></i></a>\
<a href="javascript:toggle_lock('+this.id+');"><i class="fa fa-cog" aria-hidden="true"></i></a>\
</form>\
</div>\
';
我正试图点击:
var formdata = new FormData($("#worker_edit_"+id)[0]);
为什么不起作用?它不收集所有输入数据......