var ptoken = getCookie("token");
posturl = "";
var posturl = httpPath + "/system/licence?body={\"method\":\"uploadlicence\",\"requestname\":\"licence\",\"token\":\"" + ptoken + "\"}";
$(function () {
var options = {
url: posturl,
type: "post",
dataType: "json",
success: function (data) {
if (data.errorCode != 0) {
alert (webErrorMessage[data.errorCode]);
} else {
$("#licence").val('');
alert ("update_up_success");
readlicence();
}
}
};
$('#subForm').submit(function () {
if ($("#licence").val() == "") {
alert ( "licence_check");
return false;
}
$(this).ajaxSubmit(options);
return false;
});
});
<div style=" padding:15px 50px;">
<form id="subForm" method="post" action="" enctype="multipart/form-data" >
<div style="font-size: 12px; text-align: left; font-weight: normal;">
<span >选择licence:</span>
<input type="hidden" value="1024000000" name="MAX_FILE_SIZE" />
<input type="file" id="licence" value="" size="40" name="licence" />
<input d id="uploadsubmit" name="uploadsubmit" type="submit" value="上传" class="inputImg" style="margin-left: 10px;" />
</div>
</form>
</div>