0

object_id有人知道我是否可以调用一个函数来快速向JComments中的某个人添加评论?

我一直在浏览 JComments 类,但看不到任何明显的东西。

如果我不必手动执行 SQL 插入,那就太好了。

4

1 回答 1

0

我最后做的是textarea用评论的值填充 jcomments,然后jcomments.saveComment()用超时调用它,让它有时间实际处理。

$( "#dialog-accept-ed-confirm" ).dialog({
    autoOpen: false,
    resizable: false,
    modal: true,
    buttons: {
        "Accept plan": function() {
            // Proceed with click here
            var $comment = $(".dialog_comment.accept").val();
            var $setTimeout = 0;
            if ($comment) {
                $comment = "ACCEPTANCE: "+$comment;
                addComment($comment, '.$plan_id.');
                $setTimeout = 2000;
            }
            if ($setTimeout) {
                setTimeout(function() {
                    location = href;
                }, $setTimeout);
            }
        },
        Cancel: function() {
            $(this).dialog( "close" );
        }
    }
});

$("#accept_ed_plan").click(function(e) {
    href=this.href;

    $("#dialog-accept-ed-confirm").dialog("open");
        return false;
    });

    function addComment($comment, $plan_id) {
        $("#comments-form-comment").val($comment);
        jcomments.saveComment();
        alert("Comment added to plan");
    }
});
于 2013-09-23T06:32:10.853 回答