0

我正在调用 MVC 操作,如下所示:

var RestaurantDetailsUIforForeignWidget = {
    frmId: '',
    onFormSubmit: function () {
        var frm = $(RestaurantDetailsUIforForeignWidget.frmId);
        var divResult;
        $('.offerbox').hide();
        $.post(frm.attr('action'), frm.serialize(), function (html) {
            // $('#section-time-slots').html(html)
            $('#contentAll').html(html);
            DisplayOffer();
        });
        return false;
    },
    updateTimeDesc: function () {
        $('#time').val($('#SittingTime option:selected').html());
    },
    init: function (frmId) {
        RestaurantDetailsUIforForeignWidget.frmId = frmId;
        $('#SittingTime').bind('change', RestaurantDetailsUIforForeignWidget.updateTimeDesc);
        $(frmId).bind('submit', RestaurantDetailsUIforForeignWidget.onFormSubmit);
        RestaurantDetailsUIforForeignWidget.updateTimeDesc();
    }
};

如您所见$('#contentAll').html(html);,使用结果更新整个视图内容。我想要的是从 html 输出中获取单个 div 并更新它$('#section-time-slots')

请帮助我...谢谢:)

4

1 回答 1

1

尝试这个:

    $.post(frm.attr('action'), frm.serialize(), function (html) {
        $('#section-time-slots').html($("#IdOfRequiredElementInResponse", html).html());
        DisplayOffer();
    });
于 2012-07-11T08:58:03.957 回答