ajax 上传图片,出现下载框
时间:2010-11-12
来源:互联网
今天做图片上传,用ajax提交的,但在成功执行后却不不执行ajax的success方法,而是出现下载框,感觉很诡异,请教高手,谢谢~
下面是部分代码:
ajax提交部分:
$("#uploadForm").submit(function(){
$(this).ajaxSubmit({
success: function(data){
alert(data);
},
beforeSubmit: function(){
$("#result").html("正在保存...")
}
});
return false;
});
jsp图片上传:
<div id="upLoad" style="display:none;width:400px;height: 450px">
<div class="popDialog">
<div class="popItem">
<div class="f16 b popTitle" style="">
添加实验室图片
</div>
<div class="popLine">
</div>
</div>
<div class="popItem">
<form action="../ajax/uploadImage.action" id="uploadForm" method="post" enctype="multipart/form-data">
<input type="hidden" value="labImage" name="type">
<input type="hidden" value="${lab.id}" name="labId">
<div class="clearfix popItem2">
选择图片:<input type="file" name="image" size="30"/>
</div>
<div class="clearfix popItem2">
<div style="padding-bottom:10px">图片介绍:</div>
<div><textarea style="width:320px; height: 200px" name="description"></textarea></div>
</div>
<div class="popItem tc" id="result">
</div>
<div class="popItem tc">
<button type="submit" name="" class="btn-silver" id="auploadImageSubmit">提交</button>
<button class="nyroModalClose btn-silver">取消</button>
</div>
</form>
</div>
</div>
</div>
注:action方法已经成功执行,并将数据成功插入数据库中了。点击提交之后,页面上会出现“正在保存...”,也就是说会执行ajax方法,但是之后却会出现下载框,这个问题我找了一天了,都没找到问题的所在。在此请教各位!
下面是部分代码:
ajax提交部分:
$("#uploadForm").submit(function(){
$(this).ajaxSubmit({
success: function(data){
alert(data);
},
beforeSubmit: function(){
$("#result").html("正在保存...")
}
});
return false;
});
jsp图片上传:
<div id="upLoad" style="display:none;width:400px;height: 450px">
<div class="popDialog">
<div class="popItem">
<div class="f16 b popTitle" style="">
添加实验室图片
</div>
<div class="popLine">
</div>
</div>
<div class="popItem">
<form action="../ajax/uploadImage.action" id="uploadForm" method="post" enctype="multipart/form-data">
<input type="hidden" value="labImage" name="type">
<input type="hidden" value="${lab.id}" name="labId">
<div class="clearfix popItem2">
选择图片:<input type="file" name="image" size="30"/>
</div>
<div class="clearfix popItem2">
<div style="padding-bottom:10px">图片介绍:</div>
<div><textarea style="width:320px; height: 200px" name="description"></textarea></div>
</div>
<div class="popItem tc" id="result">
</div>
<div class="popItem tc">
<button type="submit" name="" class="btn-silver" id="auploadImageSubmit">提交</button>
<button class="nyroModalClose btn-silver">取消</button>
</div>
</form>
</div>
</div>
</div>
注:action方法已经成功执行,并将数据成功插入数据库中了。点击提交之后,页面上会出现“正在保存...”,也就是说会执行ajax方法,但是之后却会出现下载框,这个问题我找了一天了,都没找到问题的所在。在此请教各位!
作者: Allyzhou 发布时间: 2010-11-12
异步后台的代码呢?
作者: shaoliang520xi 发布时间: 2010-11-12
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28