我有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