1

次のマークアップとスクリプトがあります。

<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' を呼び出せません

このエラーの原因は何ですか?

4

1 に答える 1