我有以下标记和脚本:
<div id="output" hidden>
<img src="ajax-loader.gif" />
</div>
<script src="Scripts/jquery.min.js"></script>
<script>
var promises = [
$.getJSON("./MyContacts.js"),
$("#output").fadeIn("slow"),
new $.Deferred(function (dfd) {
setTimeout(dfd.resolve, 5000);
return dfd.promise;
})
];
$.when(promises).then(
function (xhr, faded, timer) {
faded.html(xhr[0].length + " Contact(s) Found");
},
function (xhr, status) {
$('#output').html("Error retrieving contacts.")
}
);
</script>
运行代码时,我收到一条错误消息:
UncaughtTypeError:无法调用未定义的方法“html”
是什么导致了这个错误?