私はJSを使用して以下の問題について混乱しています:
var abc='';
var on=new Ajax.PeriodicalUpdater("onlinelist","URL",
{
method:'get',
onSuccess:function(transport){
abc+=transport.response;
},
frequency:1000
}
);
if(abc!=='') {
on.stop();
alert(abc);
}
However, the alert is empty; If I replace the
alert(abc);
line with
alert('123');alert(abc);
Then I'll get the expected contents from
transport.response
私は多くの材料をチェックし、なぜこれが起こるのか分からない。
私は誰かがその理由を指摘し、余分な最初のアラートを追加せずに修正できることを願っています。