以后添加 解释
<form id="file" method="post" action="#" enctype="multipart/form-data"> <input type="file" name="uploadFile" id="uploadFile" value=""> <input type="text" id="token" name="token" class="none"> <select id="dir" name="dir" value="image" class="none"><option value="image">图片</option></select> </form> <script> $.ajax({ type: 'post', data: new FormData($('#file')[0]), processData: false, contentType: false, url: upload_file, success: function(data) { data = JSON.parse(data); console.log(data); if(data.ResCode == 0) { $('.val').text(data.ResData.imgurl); if(data.ResData.linkurl != '') { $('#add_secret').val(data.ResData.linkurl); } mydata.flag = true; } }, });
</script>