Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

78
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!