I am running an AJAX call in my MooTools script, this works fine in Firefox but in Chrome I am getting a Uncaught SyntaxError: Unexpected token :
error, I cannot determine why.(我在我的MooTools脚本中运行一个AJAX调用,这在Firefox中运行良好但在Chrome中我得到一个Uncaught SyntaxError: Unexpected token :
错误Uncaught SyntaxError: Unexpected token :
错误,我无法确定原因。)
Commenting out code to determine where the bad code is yields nothing, I am thinking it may be a problem with the JSON being returned.(注释掉代码来确定坏代码的位置什么都没有产生,我想这可能是返回JSON的问题。) Checking in the console I see the JSON returned is this:(检查控制台我看到返回的JSON是这样的:)
{"votes":47,"totalvotes":90}
I don't see any problems with it, why would this error occur?(我没有看到任何问题,为什么会出现这种错误?)
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();
});
});
ask by trobrock translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…