Javascript 使用Ajax原型更新表上的数据

Javascript 使用Ajax原型更新表上的数据,javascript,html,ajax,prototypejs,Javascript,Html,Ajax,Prototypejs,我在我的项目中使用PrototypeJS,我使用了Ajax.PeriodicalUpdater,根据我的需要实时插入,但是它不能替换我表中的数据这里是html代码 <table width="200" border="0" cellspacing="0" cellpadding="0"> <tr> <th id="products"></th> </tr> </table> 但结果很糟糕,每次都会添加相同的

我在我的项目中使用PrototypeJS,我使用了Ajax.PeriodicalUpdater,根据我的需要实时插入,但是它不能替换我表中的数据这里是html代码

<table width="200" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th id="products"></th>
  </tr>
</table>

但结果很糟糕,每次都会添加相同的数据,但不会替换,我做错了什么?

好吧,你在插入,所以它。。。插入

仅供参考,赞成,但你想要的是

但是,默认值是替换——通过指定覆盖默认值的
插入
属性。有关更多详细信息,请参阅。

那么我是否删除了“插入”参数?或者我必须替换插入。从上到元素#替换?
new Ajax.PeriodicalUpdater('products', 'test.php',
  {
    method: 'get',
    insertion: Insertion.Top,
    frequency: 1,
    decay: 1
  }
);