未捕获到的SyntaxError:意外令牌:
我在MooTools脚本中运行AJAX调用,在Firefox中运行良好,但是在Chrome中出现Uncaught SyntaxError: Unexpected token :错误,我无法确定原因。注释掉代码以确定错误代码在哪里不会产生任何结果,我认为这可能是返回JSON的问题。在控制台中检查,我看到返回的JSON是这样的: {"votes":47,"totalvotes":90} 我没有看到任何问题,为什么会发生此错误? vote.each(function(e){ e.set('send', { onRequest : function(){ spinner.show(); }, onComplete : function(){ spinner.hide(); }, onSuccess : function(resp){ var j = JSON.decode(resp); if (!j) return false; var restaurant = e.getParent('.restaurant'); restaurant.getElements('.votes')[0].set('html', j.votes + " vote(s)"); $$('#restaurants .restaurant').pop().set('html', "Total Votes: " + j.totalvotes); buildRestaurantGraphs(); } }); …