我在传递$.PhotoUpdater.doUpdate(url)
执行该doUpdate
功能的 url 时遇到问题。
Firefox 返回此错误:
useless setTimeout call (missing quotes around argument?)
[Break on this error] timer = setTimeout($.PhotoUpdater.doUpdate(url), 5000)
我的代码:
$.extend({
PhotoUpdater: {
startUpdate: function(organization, gallery){
url = "/organizations/" + organization + "/media/galleries/" + gallery + "/edit_photo_captions"
timer = setTimeout($.PhotoUpdater.doUpdate(url), 5000)
},
stopUpdate: function(){
clearTimeout(timer);
timer = 0;
},
doUpdate: function(url){
$.ajax({type: "GET", url: url, dataType: "script"});
}
}
});
我怎么称呼它:
$.PhotoUpdater.startUpdate("#{@organization.id}", "#{@gallery.id}");