Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Has anyone used the bbpress ajax replies plugin??

@issobruno

Participant

after hours I get this code that works so fine!!

function bbpress_comentarios_ajax() {
    ?>
    <script type="text/javascript">
        jQuery(document).ready(function($) {
            $('#bbp_reply_submit').click(function(e) {
                e.preventDefault(); // Impede o recarregamento normal

                var form = $(this).closest('form');
                var formData = form.serialize();

                $.post(form.attr('action'), formData, function(response) {
                    // Recarrega só a área dos comentários
                    $('.bbp-replies').load(window.location.href + ' .bbp-replies > *');
                    form[0].reset(); // Limpa o campo de resposta
                });

            });
        });
    </script>
    <?php
}
add_action('wp_footer', 'bbpress_comentarios_ajax');

enjoy 🙂

Skip to toolbar