Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

82
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda