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 に答える