$('#submit').click(function () {
var formData = new FormData();
formData.append("file",$('#file')[0].files[0]);
formData.append("pid", $.trim($('#pid').val()));
$.ajax({
url:'${ctx}/vegetable/market/tree/leading',
dataType:'json',
type:'POST',
async: false,
data: formData,
processData : false, // 使数据不做处理
contentType : false, // 不要设置Content-Type请求头
success: function(data){
alert(data.message);
if (data.status == "true") {
window.location.reload();
}
},
error:function(response){
console.log(response);
}
});
})
来源:CSDN
作者:JAVA探索
链接:https://blog.csdn.net/top_explore/article/details/103826289