相关疑难解决方法(0)

$ .ajax的成功和.done()方法有什么区别

谁能帮我?
我无法理解之间的区别success.done()$.ajax.

如果可能请举例.

jquery jquery-deferred

98
推荐指数
3
解决办法
10万
查看次数

TypeError:$ .post(...).success不是函数

有人可以帮助我使用下面的代码..在Firefox开发人员工具中我收到错误信息:: TypeError:$ .post(...).success is not a function

所有变量都从表单页面提交.

任何意见和建议将不胜感激......

谢谢

$(document).ready(function(){

    $('#post-comment-btn').click(function(){

        var _comment = $('#comment-post-text').val();
        var _userId = $('#userId').val();
        var _userName = $('#userName').val();

        if(_comment.length > 0 && _userId != null) {

            $.post("ajax/comment_insert.php",

                {
                    task : "comment_insert",
                    userId : _userId,
                    comment: _comment,


                }
                ).success(
                    function(data)
                {
                    console.log("ResponseText:" + data);
                }

                );


            console.log(_comment + " Username: " + _userName + " User Id: " + _userId);

        } else {

            console.log("The text area is empty..");

        }

        $('#comment-post-text').val("");


    });

});
Run Code Online (Sandbox Code Playgroud)

javascript jquery

-1
推荐指数
1
解决办法
5429
查看次数

标签 统计

jquery ×2

javascript ×1

jquery-deferred ×1