谁能帮我?
我无法理解之间的区别success和.done()的$.ajax.
如果可能请举例.
有人可以帮助我使用下面的代码..在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)