我正在尝试输入 2 个 div,.totalmembers
并且.totalcomm
每 60 秒从一个 json 文件中输入一次。
json 文件看起来像这样,{ "members": { "data": [ { "TotalMembers": 14 } ] }, "communities": { "data": [ { "TotalCommunities": 10 } ] } }
我在这里做错了什么?
$(function FeedTicker() {
$.ajax({
type: "GET",
url: "default.cs.asp?Process=ViewStats",
dataType: 'json',
success: function(data) {
if (index == "members") {
$(".totalmembers").html(data.totalmembers);
} else if (index == "communities") {
$(".totalcomm").html(data.totalcommunities);
}
$('.totalmembers').ajaxSuccess(function(){
$(this).ticker({
pauseOnItems: 6000,
displayType: 'fade',
controls: false,
titleText: ''
});
})
$('.totalcomm').ajaxSuccess(function(){
$(this).ticker({
pauseOnItems: 6000,
displayType: 'fade',
controls: false,
titleText: ''
});
})
}
})
});