js代码
<script src="js/jquery.min.js"></script> <script src="js/bootstrap-fileinput.js"></script> <script type="text/javascript"> $(function () { //比较简洁,细节可自行完善 $('#uploadSubmit').click(function () { var data = new FormData($('#uploadForm')[0]); $.ajax({ url: 'xxx/xxx', type: 'POST', data: data, async: false, cache: false, contentType: false, processData: false, success: function (data) { console.log(data); if(data.status){ console.log('upload success'); }else{ console.log(data.message); } }, error: function (data) { console.log(data.status); } }); }); }) </script>
在线预览
资源均来自第三方,谨慎下载,前往第三方网站下载