当点击div(不是button),如何实现图片 ajax/jquery上传并能直接看到,不用刷新网页
网上许多ajax jquery 上传图片都要用到submit button, 请问如何上传并直接在本页看到当用户点击div? 生死攸关问题,多谢先。
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<body>
<input multiple class="fileInput" type="file" id="files" name="files[]"/>
<br>
<div id="submit" > click me to pass the photo to upload.php</div>
<div name="photoreturn"></div>
</body>
</html>
<style>
#submit{
background-color: #ffcc99;
display:inline-block;
padding:5px;
border-radius: 3px;
cursor:pointer;
}
</style>
杰克比利2
9 years, 5 months ago