使用jquery点击帖子后如何自动隐藏我的评论框?

时间:2014-04-19 14:34:30

标签: javascript php jquery mysql css

我现在已经发表了我的评论框,我想自己设计它,因为点击后#34;发布"按钮它会自动隐藏锹,实际上我在菜单上做了这个我的意思是当用户点击进入菜单(如Facebook通知菜单),这个框会出现,提交后它会自动消失,现在请帮助怎么做?

这是我的表单脚本:

$(document).ready(function(){
    /* The following code is executed once the DOM is loaded */

    /* This flag will prevent multiple comment submits: */
    var Posting = false;

    /* Listening for the submit event of the form: */
    $('#addCommentForm').submit(function(e){

        e.preventDefault();
        if(Posting) return false;

        posting = true;
        $('#submit').val('Posting..');
        $('span.error').remove();

        /* Sending the form fileds to submit.php: */
        $.post('submit.php',$(this).serialize(),function(msg){

            working = false;
            $('#submit').val('Post');

            if(msg.status){

                /* 
                /   If the insert was successful, add the comment
                /   below the last one on the page with a slideDown effect
                /*/

                $(msg.html).hide().insertBefore('#addPostingContainer').slideDown();
                $('#body').val('');
            }
            else {

                /*
                /   If there were errors, loop through the
                /   msg.errors object and display them on the page 
                /*/

                $.each(msg.errors,function(k,v){
                    $('label[for='+k+']').append('<span class="error">'+v+'</span>');
                });
            }
        },'json');

    });

});

0 个答案:

没有答案
相关问题