<div>
<form enctype="multipart/form-data" id="form2">
<input type="file" name="f1" id="f1"/>
<button type="button" id="importExcel">导入</button>
</form>
</div>
$('#importExcel').click(function () {
$('#form2').ajaxSubmit({
url: 'http://127.0.0.1:8083/api/v1/excelImport?apiKey=def80480e244d9385b71a8c530d8a3eee6e6397c',
type: 'post',
async: true,
data: $('#form2').serialize(),
dataType: "json",
success: function (data) {
$('#fillDate').val(data.fillDate);
$('#name').val(data.name);
$('#startDate').val(data.startDate);
$('#endDate').val(data.endDate);
$('#destination').val(data.destination);
$('#reason').val(data.reason);
$('#isBasis').val(data.isBasis);
}
});
});