0
我打电话jQuery的一个JSON源,看起来像这样:jQuery的JSON调用返回空
{
total: 1,
current: 0
}
我的jQuery以下脚本是从JSON调用返回NULL,我不能工作了,为什么?数据源正确并正常工作。
$.ajax({
url: source,
cache: false,
beforeSend: function(){
target.before('<div class="feed-loading"></div>', function(){
target.slideUp();
});
},
success: function(html){
/* load feed data into target */
target.html(html).slideDown();
$('.feed-loading').fadeOut();
/* updates attendances */
$('.actionpanel a.attend').each(function(index) {
var event_id = $(this).attr('rel');
/* find if logged in user is attending */
$.getJSON(settings.base_url + 'ajax/event_attendance/' + event_id, function(attendance) {
console.log(attendance);
/* update attendance figures on page */
$('a.attend[rel="' + event_id + '"]').nextAll('.meta').text(attendance.total + ' attending');
if (attendance.current == 1) {
$('a.attend[rel="' + event_id + '"]').addClass('selected').attr('title', 'You are attending!');
};
});
});
}
});
我觉得一定有什么做的实际上它是我在其他地方使用类似的代码和它的工作确定另一个Ajax调用内。
对不起,似乎是一个复制粘贴问题。 json确实有一个逗号。不管怎么说,还是要谢谢你。 – Plasticated 2011-05-12 18:07:36