1.代码片段一:

 ajaxUpload: function () {
var url = this.$avatarForm.attr('action'),
data = new FormData(this.$avatarForm[0]),
_this = this; $.ajax(url, {
type: 'post',
data: data,
dataType: 'json',
processData: false,
contentType: false, beforeSend: function () {
_this.submitStart();
}, success: function (data) {
_this.submitDone(data);
}, error: function (XMLHttpRequest, textStatus, errorThrown) {
_this.submitFail(textStatus || errorThrown);
}, complete: function () {
_this.submitEnd();
}
});
},

2.代码片段二:

$(document).ready(function (e) {
$("#uploadForm").on('submit',(function(e) {
e.preventDefault();
$.ajax({
url: "upload.php",
type: "POST",
data: new FormData(this),
contentType: false,
cache: false,
processData:false,
success: function(data)
{
$("#targetLayer").html(data);
},
error: function()
{
}
});
}));
});

最新文章

  1. Nginx+Keepalived(带Nginx监控脚本)
  2. 新平台,新版本,ComponentOne 持续发力
  3. 最牛逼android上的图表库MpChart(二) 折线图
  4. POJ 1329 Circle Through Three Points(三角形外心)
  5. SCOM资源池
  6. http://www.mxchip.com/talk/news/jishuwenzhang/2014-09-11/67.html
  7. GO语言中的指针
  8. yii图片上传
  9. JSP中的相对路径和绝对路径(转)
  10. rowid去重(删除表的重复记录)
  11. React文档翻译 (快速入门)
  12. python基础之数据类型与变量
  13. SUSE11sp3 perf工具安装过程
  14. 在安卓手机上通过虚拟机运行Windows XP
  15. mysql分区方案的研究
  16. kill、killall、pkill杀手三人组
  17. ubuntu下截图工具推荐 -- [deepin-scrot]
  18. 移动端自动化测试-WTF Appium?
  19. swift中UIImageView的创建
  20. Linux下Tomcat的启动、关闭

热门文章

  1. 父元素没有设置定位 position absolute 解析
  2. git gui :Updating the Git index failed. A rescan will be automatically started to res
  3. 解决Android SDK Manager下载问题和android studio每次启动都要在fetching Android sdk compoment information
  4. chrome 禁止自动更新
  5. iOS-仿智联字符图片验证码
  6. nginx根据token做频率限制
  7. 在一个SQL Server表中一行的多个列找出最大值
  8. Js/jQuery实时监听输入框值变化
  9. laravel 数据库查询的一些函数意义(未完)
  10. IOS基于XMPP协议开发--XMPPFramewok框架(二):服务器连接