有没有人有与jQuery AJAX和beforeSend属性相同的经验?任何建议如何解决这个问题?jquery ajax请求发送之前发送
我想要通过AJAX发送新数据到数据库(我需要到所有评论的最后一页)之前,我正在从数据库中读取一个AJAX调用。 beforeSend会发生什么情况,以检索后面应该发送的数据。有任何想法吗?
$.ajax({
type: 'POST',
url: '_php/ajax.php',
dataType:"json",
async:false,
data:{
action : "addComment",
comment_author : comment_author_val,
comment_content : comment_content_val,
comment_parent_id : comment_parent_id_val,
comment_post_id : "=$_REQUEST["ID"]?>"
},
beforeSend: function() {
//WHAT A MESS...
if (typeof commentOpen == "undefined") {
$.get("_php/ajax.php", { action: "getComments", commentPage: '', ID: "=$_REQUEST["ID"]?>" },
function(data){
$('#comments > ul').html(data);
return true;
}
);
}
},
2010-03-18
Bosh
+0
其实我可以写有点不同的...喜欢复位AJAX - >回调 - >编写AJAX - > APPEND HTML TO DOM ... 但我实际上想使用beforeSend –