jQuery-File-Upload未在Internet Explorer(IE9)中触发完成回调 [英] jQuery-File-Upload not firing done callback in Internet Explorer (IE9)

查看:444
本文介绍了jQuery-File-Upload未在Internet Explorer(IE9)中触发完成回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我检查了一些有关同一问题的问题, blueimp jquery文件上传 - " done"," complete"回调不适用于IE 9 ,但即使将我的Content-Type作为'text / html'作为响应,'完成'回调也没有被触发。此外,jQuery-File-Upload说我需要重定向来获取上传的文件( https://github.com/blueimp/jQuery-File-Upload/wiki/Cross-domain-uploads ),但也没有完成。
任何帮助将不胜感激。
问候。

i checked some questions regarding the same issue, blueimp jquery file upload - "done", "complete" callbacks not working for IE 9 , but even after putting my Content-Type as 'text/html' as the response the 'done' callback isn't being fired. Also as the jQuery-File-Upload says i need to have a redirect to get the uploaded file (https://github.com/blueimp/jQuery-File-Upload/wiki/Cross-domain-uploads) after the upload is done, but that isn't also being done. Any help would be appreciated. Regards.

推荐答案

投票最多的答案不是最好的解决方案,可能会抛出错误。实际上,建议不要为IE<设置 dataType 。 10,从这篇(真棒)文章:

The most voted answer isn't the best solution and can throw errors. Actually, setting dataType isn't recommended for IE < 10, from this (awesome) article:


当dataType选项设置为text,json,html或script时,
iframe传输执行一些响应处理。因为
是在从它使用的iframe获得的DOM对象上运行的,然而
,而不是原始的HTTP响应数据,有一些惊喜可能突然出现的

When the dataType option is set to text, json, html, or script, the iframe transport performs some processing of the response. Because it is operating on a DOM object obtained from the iframe it uses, however, and not the raw HTTP response data, there is the potential for some surprises to pop up.

http://missioncriticallabs.com/blog/2012/04/lessons-learned-from-jquery-file-upload/

真正的解决方案:

关于不在IE中触发的事物< 10与 dataType 无关,只是缺少回调 add ,强制文件在fileupload事件中推送。

The "thing" about not firing in IE < 10 isn't related with dataType, is just the lack of callback add that forces the file push in fileupload event.

$('#file_file').fileupload({
    add: function (e, data) {
        data.submit(); //this will 'force' the submit in IE < 10
    },
    done: function (e, data) {
        alert('Done');
    }
});

这篇关于jQuery-File-Upload未在Internet Explorer(IE9)中触发完成回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆