下载地址:http://malsup.com/jquery/form/#download
Github主页:https://github.com/malsup/form
中文在线文档:http://www.vaikan.com/docs/jquery.form.plugin/jquery.form.plugin.html
英文在线文档:http://jquery.malsup.com/form/
上传图片
触发事件:
<script type = "text/javascript">
//使用插件 jquery.form.js
function uploadPic()
{
var options =
{
url : "/upload/uploadPic.do",
dataType: "json",
type : "post",
success: function()
{
$("#allUrl").attr("src","图片路径");
$("#imgUrl").val("图片路径");
}
}
$("#jvForm").ajaxSubmit( options );//上传
}
</script>
<form id = "jvForm" >
<img id = "allUrl" src = "" /> <-- 显示图片 -->
<input id = "imgUrl" type = "hidden" name = "imgUrl" value = "" > <-- 图片的隐藏域 -->
<input type = "file" name = "pic" onchange = "uploadPic()" / >
</form>