0

I have a View called 'example' with the Pager turned on and Ajax turned on.

I have a script that refreshes the View by providing a path as an argument.

    $('.view-example a')
        .live('click', function(e) {
            e.preventDefault();

            var trigger = $(this),
            arg = trigger.attr('href');

            $.ajax({
                dataType: 'json',
                type: 'GET',
                url: '/views/ajax?view_name=example&view_display_id=block_1&view_args='+arg,
                success: function(data) {
                    $('#container').html(data.display);
                },
            });
    });

That all works fine. Although once the Ajax event has succeeded the View's pager doesn't work as expected. Instead it displays the json data of the view.

1

Append the following line in the 'success' function

Drupal.attachBehaviors('#container');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.