Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reply only works on page refresh #140

Open
lbreguet opened this issue Jul 3, 2018 · 1 comment
Open

Reply only works on page refresh #140

lbreguet opened this issue Jul 3, 2018 · 1 comment

Comments

@lbreguet
Copy link

lbreguet commented Jul 3, 2018

There's an issue I'm having with the Reply button. After posting a comment on the website, the comment gets saved to the server and appears on the page. When I click on the Reply button, however, nothing happens. Once I reload the page does the button actually do something.

Here's the code for posting a comment:

postComment: function(commentJSON, success, error) {
            commentJSON['__metadata'] = {  
                'type': 'SP.Data.CommentsListItem' // it defines the ListEnitityTypeName  
            }
            commentJSON.PageId = currentpage;
            commentJSON.FullName = currentuserName;
            commentJSON.CreatedByCurrentUser = false;
            delete commentJSON['pings']
            commentJSON.CommentId = commentJSON.Id;
            delete commentJSON['Id'];

            $.ajax({
                type: 'post',
                url: siteUrl + "/_api/web/lists/GetByTitle('Comments')/items",
                headers: {
                    "Accept": "application/json;odata=verbose",
                    "content-type": "application/json;odata=verbose; charset=UTF-8",
                    "X-RequestDigest": jQuery("#__REQUESTDIGEST").val()
                },
                data: JSON.stringify(commentJSON),
                success: function() {
                    success(commentJSON);
                    commentsArray.push(commentJSON);
                    $('.total-comments').text('Total comments: ' + commentsArray.length);
                    $('.total-comments-header').text(commentsArray.length);
                    console.log("new comment object: ");
                    console.log(commentJSON);
                },
                error: function (error) {
                    console.log(JSON.stringify(error));
                    console.log("Broke posting comment");
                    debugger;
                }
            });
        }

Keep in mind that I'm using Jquery Comments in a SharePoint page.

Any help would be much appreciated!

@ALIFKI
Copy link

ALIFKI commented Jan 31, 2019

I also have the same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants