Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <a class="delCommentLink" href="{% url 'article:comment_delete' comment.id %}">
- <span id="{{ comment.id }}" class="glyphicon glyphicon-trash" aria-hidden="true">delete</span>
- </a>
- $(document).ready(function () {
- $("body").on("click",".delCommentLink",function (e) {
- e.preventDefault();
- var comment_url = $(e.target).parent().attr("href");
- var $commentEle = $(e.target).closest(".comment");
- if (window.confirm("Delete this comment?")) {
- $.ajax({
- type: "get",
- url: comment_url,
- success: function (data) {
- var ret = JSON.parse(data);
- if (ret['status'] == 1) {
- $commentEle.hide();
- } else {
- alert(ret['msg']);
- };
- },//success
- });//ajax
- } else {
- e.preventDefault()
- }
- });//click event
- })
Add Comment
Please, Sign In to add comment