我有问题Internet Explorer
这是一个带有 AJAX 和 jQuery 的脚本示例,在其他浏览器中运行良好,但在其他浏览器中IE
却不行
索引.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
它不工作。
这是 CONSOLE( F12
) 错误IE
SCRIPT5009: 'FormData' is undefined
ajax.js, line 53 character 9
我应该怎么做才能解决问题?