Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

80
Visualizações
Refresh comments after postComment - jquery-comments.js

I am using this jquery-comments plugin for a small conversation functionality. and this works good.

Only issue is it does not refresh comments after we post a comment and just adds new comment row, so if another person make a comment from his side, it will not show until we refresh full page.

So i am able to fetch the new comments from database by ajax, which works good.

getLastestComments: function(){
        var new_comments_array  = null;
        $.ajax({
            url: 'index.php?route=extension/module/getLastestComment&user_token='+ this.options.primaryId,
            async: false,
            success: function(json) {
               new_comments_array = json['data'];
            },
          });
          return new_comments_array ;
    }

Only thing i am not able to configure is how can i refresh this Comments(Render Again); I have tried, couple of things but no luck. Like inside the postComment : function

I adds : this.render() [this function loads on pageload and render comments], this.createComments(), etc.

postComment: function(ev) {
        var self = this;
        var sendButton = $(ev.currentTarget);
        var commentingField = sendButton.parents('.commenting-field').first();

        // Set button state to loading
        this.setButtonState(sendButton, false, true);

        // alert(this.options.primaryId);
        // Create comment JSON
        var commentJSON = this.createCommentJSON(commentingField);

        // Reverse mapping
        commentJSON = this.applyExternalMappings(commentJSON);

        var success = function(commentJSON) {
            self.createComment(commentJSON);
            commentingField.find('.close').trigger('click');

            // Reset button state
            self.setButtonState(sendButton, false, false);
        };

        // this.getComments();
        // self.getComments();
        var error = function() {

            // Reset button state
            self.setButtonState(sendButton, true, false);
        };

        this.options.postComment(commentJSON, success, error);
        this.options.refresh();

        console.log(this.createComments());
         this.render();
         this.createComments();
        // if(this.options.enableAttachments && this.options.enableNavigation) this.createAttachments();
    },

Quite a simple thing, but Anyone have any guess about this? Thanks for your time

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda