开发者社区> 问答> 正文

我是javascript新手,只是尝试使用ajax从input获取数据,并附加在我的评论部分

    var comment = $("#commentPost").val();

    if(comment.lenght > 5){}
    $.ajax({
                url: 'home.php',
                method: 'POST',
                dataType: 'text',
                data: {
                    comment: comment
                },
                success: function (response) {
                    $("#commentPost").val("");
                    $(".commentRow").hide();
                    $('.commentRow').parent().next().append(response);
                }
    });

展开
收起
社区秘书 2019-11-27 16:17:58 705 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
JavaScript函数 立即下载
Delivering Javascript to World 立即下载
编程语言如何演化-以JS的private为例 立即下载