jQuery FileUpload doesn't trigger 'done'
If your server is not returning JSON, try removing:
dataType: 'json'
Otherwise you may be ending up with a fail event, which is easy to test for:
fail: function(e, data) {
alert('Fail!');
}
https://github.com/blueimp/jQuery-File-Upload/wiki/Options#datatype
AJAX Options
The jQuery File Upload plugin makes use of jQuery.ajax() for the file upload requests. This is true even for browsers without support for XHR, thanks to the Iframe Transport plugin.
The options set for the File Upload plugin are passed to jQuery.ajax() and allow to define any ajax settings or callbacks.
The ajax options processData
, contentType
and cache
are set to false
for the file uploads to work and should not be changed.
The timeout
setting is set to 0
. See pull request #3399 for the reasoning behind this.
The following options are also set by the plugin, but can be useful to customize:
url
A string containing the URL to which the request is sent.
If undefined or empty, it is set to the action property of the file upload form if available, or else the URL of the current page.
- Type: string
- Example:
'/path/to/upload/handler.json'
type
The HTTP request method for the file uploads. Can be "POST", "PUT" or "PATCH" and defaults to "POST".
- Type: string
- Example:
'PUT'
Note:
"PUT" and "PATCH" are only supported by browser supporting XHR file
uploads, as iframe transport uploads rely on standard HTML forms which
only support "POST" file uploads. See Browser support.
If the type is defined as "PUT" or "PATCH", the iframe transport will
send the files via "POST" and transfer the original method as "_method"
URL parameter.
Note:
As was noted above, it's a common practice to use "_method" to transfer
the type of your request. For example, "Ruby on Rails" framework uses a
hidden input with the name "_method" within each form, so it will likely
override the value that you will set here.
dataType
The type of data that is expected back from the server.
Note: The UI version of the File Upload plugin sets this option to "json" by default.
- Type: string
- Example:
'json'
done
Callback for successful upload requests. This callback is the equivalent to the success callback provided by jQuery ajax() and will also be called if the server returns a JSON response with an error property.
- Example:
function (e, data) {
// data.result
// data.textStatus;
// data.jqXHR;
}
jQuery FileUpload doesn't trigger 'done'的更多相关文章
- jQuery FileUpload等插件的使用实例
1.jQuery FileUpload 需要的js: jquery.js jquery.fileupload.js jquery.iframe-transport.js jquery.xdr-tran ...
- 另一种图片上传 jquery.fileupload.js
今天遇到另外一种上传图片方法 用jquery.fileupload.js <input type="file" name="file[]" multipl ...
- jquery.fileupload插件的简易使用日志
来源:http://yixiandave.iteye.com/blog/1897330 本文内容主要包含fileupload插件传递参数和取回服务器返回数据的方法 jquery.fileupload官 ...
- 关于jquery.fileupload结合PHP上传图片的开发用法流程
这阵子做了一个项目,涉及到了图片上传,以往用的都是uploadify这个插件,感觉它在PC上的使用还是很强大的, 不过最近这个项目涉及到了移动端的上传,其实uploadify也可以,但是他有一个 up ...
- MVC文件上传-使用jQuery.FileUpload和Backload组件实现文件上传
本篇使用客户端jQuery-File-Upload插件和服务端Badkload组件实现多文件异步上传.MVC文件上传相关兄弟篇: 处理文件上传的服务端组件Backload 用于处理文件上传的服务端组件 ...
- 使用jQuery.FileUpload插件和服Backload组件自定义上传文件夹
在零配置情况下,文件的上传文件夹是根目录下的Files文件夹,如何自定义文件的上传文件夹呢? □ 在web.config中配置 1: <configuration> 2: <conf ...
- 使用jQuery.FileUpload和Backload自定义控制器上传多个文件
当需要在控制器中处理除了文件的其他表单字段,执行控制器独有的业务逻辑......等等,这时候我们可以自定义控制器. 通过继承BackloadController □ 思路 BackloadContro ...
- 使用jQuery.FileUpload插件和Backload组件裁剪上传图片
□ 思路 1.自定义控制器继承Backload的默认控制器BackloadController2.自定义一个jQuery File Upload初始化js文件,使用自定义控制器的方法3.在视图页面调用 ...
- jquery 自动触发事件 trigger
trigger() 栗子: 需求:我们在做二级联动的时候往往会遇到这样的需求,后台管理端页面加载完成后显示用户的省份,城市,并且可以对用户的省份,城市信息可以修改 如果只是简单的显示 你完全可以直接放 ...
随机推荐
- spring中@Autowired与 @Resource区别
@Autowired 与@Resource的区别: 1. @Autowired与@Resource都可以用来装配bean. 都可以写在字段上,或写在setter方法上. 2. @Autowired默认 ...
- 剑指offer--day05
1.1 题目:二进制中1的个数:输入一个整数,输出该数二进制表示中1的个数.其中负数用补码表示. 1.2 解题思路:通过位移来进行.举例:7(二进制:0111),7 >> 1(得到:001 ...
- SSM003/构建Maven单模块项目(二)
一.Controller基础代码(mooc) 1.UserController.java /** *springmvc1-2:返回jsp页面 * 请求URL: /user/getUserById?us ...
- 关于this在不同使用情况表示的含义
1. addEventListener 函数中的this 指向的是出发事件的事件源 obj.addEventListener('click',function(){ console.log(thi ...
- IQueryable在LINQ中
IQueryable接口定义如下: // 摘要: // 提供对未指定数据类型的特定数据源的查询进行计算的功能. public interface IQueryable : IEnumerable { ...
- ceph部署-基础部署
一.硬件要求:CPU:4C内存:每个守护进程需要500MRAM,1TB存储对应1GRAM磁盘:至少1TB网卡:1GB以上,最好两个 centos7环境安装 二.CEPH安装1.建立管理节点(1)添加y ...
- <每日一题> Day2:CodeForces-1141C.PolycarpRestoresPermutation(思维题)
原题链接 参考代码: #include <iostream> #include <cstring> using namespace std; + , INF = 0x3f3f3 ...
- dp(电梯与楼梯)
http://codeforces.com/problemset/problem/1249/E E. By Elevator or Stairs? time limit per test 2 seco ...
- wamp 环境的配置
安装完wamp之后,基本不用配置什么环境,只要将mysql添加到你的环境变量中去即可.
- 年月日联动select下拉菜单
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...