【发布时间】:2017-09-24 20:58:21
【问题描述】:
有人可以帮我编写下面的代码吗?在 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("");
});
});
【问题讨论】:
-
我的意思是......这个功能已经很久没有存在了。永久弃用,并在 3.0 中删除 api.jquery.com/jquery.ajax
标签: javascript jquery