0

I am calling MVC action something like below:

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();
    }
};

As you can see $('#contentAll').html(html); updates whole view content with the result. What I want is to get a single div from html output and update the $('#section-time-slots') instead.

Please help me guys... thanks :)

1
  • Does the server have to return the full view, cant it return only the section that you want so that you can update your $('#section-time-slots') Commented Jul 11, 2012 at 8:55

1 Answer 1

1

Try this:

    $.post(frm.attr('action'), frm.serialize(), function (html) {
        $('#section-time-slots').html($("#IdOfRequiredElementInResponse", html).html());
        DisplayOffer();
    });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.