我有Internet Explorer
jQuery的AJAX上传系统IE probem
这里的问题是AJAX和jQuery脚本的样本,并在其他浏览器工作正常,但在IE
它不
的index.html
<form enctype="multipart/form-data" method="post">
<input name="file" type="file" multiple="true" id="file" />
<input type="button" value="Upload" /> or clic "U"
</form>
ajax.js
其他$(':button').click(function(){
var formData = new FormData($('form')[0]);
$("#data").html(formData);
$.ajax({
url: 'upload.php', //server script to process data
type: 'POST',
xhr: function() { // custom xhr
myXhr = $.ajaxSettings.xhr();
if(myXhr.upload){ // check if upload property exists
myXhr.upload.addEventListener('progress',progressHandlingFunction, false); // for handling the progress of the upload
}
return myXhr;
},
//Ajax events
//beforeSend: beforeSendHandler,
success: function(html) {
$("#php").html(html);
$("#file").val('');
},
error:function(html) {
$("#php").html(html);
},
enctype: 'multipart/form-data',
// Form data
data: formData,
//Options to tell JQuery not to process data or worry about content-type
cache: false,
contentType: false,
processData: false
});
});
工作正常浏览器,但在Opera
和IE
它不起作用。
这是控制台(F12
)erron上IE
SCRIPT5009: 'FormData' is undefined
ajax.js, line 53 character 9
我应该怎么做才能解决这个问题?
出版社IE F12,进入控制台标签上传,然后触发你的代码。它应该输出一个错误。将错误粘贴到您的问题 – 2012-08-09 19:06:57
SCRIPT5009:'FormData'未定义 ajax.js,第53行字符9这是代码 – 2012-08-09 19:09:29