jQuery File Upload示例代码:
$('#uploadify1').fileupload({
url: 'doc.jsp',
dataType :'text',
forceIframeTransport: true,
done: function(e, data){
$('#fileQueue').html(data.result);
}
}).on('fileuploaddone', function(e, data){
});
在IE6~IE8中使用jQuery File Upload 或者将forceIframeTransport
设置为true
时,需要引入 jquery.iframe-transport.js 。
会出现在done
以及fileuploaddone
回调函数中,无法从data
获取result
的问题。此时,需要将dataType
修改为对应iframe text
iframe json
iframe html
iframe xml
iframe script
。
例:将text
修改为iframe text
$('#uploadify1').fileupload({
url: 'doc.jsp',
dataType :'iframe text',
forceIframeTransport: true,
done: function(e, data){
$('#fileQueue').html(data.result);
}
}).on('fileuploaddone', function(e, data){
});