html部分
<div style="width: 99%;margin: 0px auto;border-bottom: 2px solid #000;background: #fff;">
<p><input type="file" id="upfile" name="files" style="" value="上传excel" style="margin:5px"></p><p><input type="button" id="upJQuery" value="预览" class="btn" ></p>
<p><input type="button" value="确定" id='queding' class="btn"></p>
</div>
js部分
$('#upJQuery').on('click', function() {
var html = '',phd = $('#fuzhi').html() ;
var fd = new FormData();
if($('#upfile').val().trim()==''){
layer.msg('请选择文件');
return false ;
}else{
fd.append("upload", 1);
fd.append("file", $("#upfile").get(0).files[0]);
$.ajax({
url: "/ConfigYieldManageController/previewConfigYieldManage.do",
type: "POST",
processData: false,
contentType: false,
dataType:'JSON',
data: fd,
success: function(d) {
}
});
}
});
$('#queding').on('click', function() {
var fd = new FormData();
if($('#upfile').val().trim()==''){
layer.msg('请选择文件');
return false ;
}else{
fd.append("upload", 1);
fd.append("file", $("#upfile").get(0).files[0]);
$.ajax({
url: "",
type: "POST",
processData: false,
contentType: false,
dataType:'JSON',
data: fd,
success: function(d) {
}
});
}
});