我在使用IE9中的jQuery.form.js
时遇到问题,其中XHR返回<form>
的DOM,而不是来自POST
的响应。IE9中的JQuery.Form.JS XHR错误
我创建了一个jsfiddle来演示基于this(它在IE9中有效)的问题。
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
<script src="http://malsup.github.com/jquery.form.js"></script>
</head>
<body>
<form action="http://jquery.malsup.com/form/file-echo2.php" method="post" enctype="multipart/form-data">
<input type="file" name="myfile">
<input type="submit" value="Submit">
</form>
<div id="status"></div>
<script>
(function() {
var status = $('#status');
$('form').ajaxForm({
//xhrFields: {withCredentials: true},
beforeSend: function() {
status.html("Submitting...");
},
success: function() {
status.html("Done...");
},
complete: function(xhr) {
status.html(xhr.responseText);
}
});
})();
</script>
</body>
由于原来的例子在IE 9,我想我的jsfiddle应该工作,但我不能弄清楚。任何帮助深表感谢。