未捕獲的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();
}
});
e.addEvent('submit', function(e){
e.stop();
this.send();
});});
未捕獲的SyntaxError:意外的令牌:
慕少森
2019-07-31 18:38:16
