<div>
<table id="outputInfo">
<tr><td>Client</td><td><input id='ClientName' type='text'></td></tr>
<tr><td>CropID</td><td><input id='CropID' type='text' /></td></tr>
<tr><td>Secret</td><td><input id='Secret' type='text'/></td></tr>
<tr><td>AppID</td><td><input id='AppID' type='text'/></td></tr>
<tr><td>Logo</td><td><input id='Logo' type='file'/></td></tr>
</table>
</div>
<button id="saveInfo">Save</button>
$("#saveInfo").click(function () {
var clientName = $("#ClientName").val();
var CropID = $("#CropID").val();
var Secret = $("#Secret").val();
var AppID = $("#AppID").val();
var formData = new FormData();
alert(clientName);
formData.append("file", document.getElementById("Logo").files[0]);
formData.append("clientName", clientName);
formData.append("CropID", CropID);
formData.append("Secret", Secret);
formData.append("AppID", AppID);
$.ajax({
url: "上传地址",
data: formData,
type: "POST",
contentType: false,//这里
processData: false,//这两个一定设置为false
success: function (info) {
if (info == "success") {
alert("成功上传");
} else {
alert(info);
}
}
});
});