jQuery Deferred:TypeError e未定义

时间:2013-11-21 14:09:59

标签: javascript jquery promise jquery-deferred

我的代码返回错误TypeError:当我在done()方法中调用以下方法时,e未定义:

replaceContent : function(data) {

    var defer = $.Deferred();

    if (data.replaceContent === '' || typeof data.replaceContent === 'undefined') {

        defer.resolve(data);

    }

    var thisIndex = 0;

    $.each(data.replaceContent, function(k, v) {

        $(k).html(v);

        ++thisIndex;

        if (thisIndex === data.replaceContent.length) {

            defer.resolve(data);

        }

    });

    return defer.promise();

}

知道为什么吗?

0 个答案:

没有答案