issobruno (@issobruno)

Forum Replies Created

Viewing 1 replies (of 1 total)
  • @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 🙂

Viewing 1 replies (of 1 total)