我有这个代码的问题:jQuery和Ajax请求的数据问题
setInterval(function() {
var timed = $("#chMsgCont").find(".chatMsg:last-child");
var timee = timed.attr("data");
$.ajax({
url: "./ajax/checknew.php",
data: {timestamp: timee},
success: function(data) {
$("#chMsgCont").append(data);
if(data != null) {
var div = $('#chMsgCont');
var o = div.offset().top;
div.scrollTop(o + 12302012);
}
}
});
},1000);
即使数据为空,$("#chMsgCont)
向下滚动,为什么呢?
一个空字符串不等于空 – Musa 2012-08-09 21:50:27
也许数据仅仅是空的或未定义的,不为空以便它能够传递 – 2012-08-09 21:50:31
可以是数据是空字符串?? – Amareswar 2012-08-09 21:51:44