jQuery File Upload done函数没有返回

最近在使用jQuery File Upload 上传图片时发现一个问题,发现done函数没有callback,经过一番折腾,找到问题原因,是由于dataType: ‘json’造成的,改为autoUpload: true问题解决。

一个完整的jQuery File Upload上传图片实例如下:

	$("#fileuploader).fileupload({
	    //dataType: 'json',
	    autoUpload: true,
	    acceptFileTypes:  /(\.|\/)(gif|jpe?g|png)$/i,
	    maxNumberOfFiles : 1,
	    url:ctx+'url',
	    add: function (e, data) {
	        data.submit(); //this will 'force' the submit in IE < 10
	    },
	    progressall: function (e, data) {
                //进度条
	        var progress = parseInt(data.loaded / data.total * 100, 10);
	        $('#progress .bar').css(
	            'width',
	            progress + '%'
	        );
	    },
	    done:function(e,result){ 
	    	//完成后进行的操作	        
	    },
	    fail: function(e, data) {
                  //错误提示
	    	  alert('Fail!');
	    }
	});
posted @ 2016-06-12 09:29  东方哥哥  阅读(946)  评论(0编辑  收藏  举报