我需要在网站上解决问题,而我无法弄清楚如何解决问题。我有动态下载文章的功能,但当它包含%符号时会抛出parseerror。任何人都可以帮助我更改此功能以使用%符号并向我解释JSON行为吗?
$('.funfan_more').click(function(){
if((offset*fun)+fun>=fun_count && (offset*fan)+fan>=fan_count){
$('.load_more').html('').css('height','30px').css('background','none');
}
ajaxLoader.show();
if(!loading) {
loading = true;
$.ajax('<?php echo URL::site('load_posts'); ?>',{
async: false,
type: 'GET',
data: {
offset: offset
},
dataType: 'json',
cache: false,
error: function( jqXHR, textStatus, errorThrown ) {
alert('Ups, some we have some' + textStatus + ' error here.');
},
success: function( data, textStatus, jqXHR ) {
$('.ff_left').append(data.a);
$('.ff_right').append(data.b);
offset++;
setTimeout(function(){
Cufon.refresh();
loading = false;
ajaxLoader.hide();
}, 1000);
}
});
}
return false;
});
答案 0 :(得分:0)
我找到了解决方案。脚本错误地为网站预制了Feed。这是一个Kohana对象推送到字符串女巫sprintf函数,如果%在网站Feed中,则会出错。将正常投射的sprintf更改为String类型有帮助。