im using PrototypeJS for my project, i used Ajax.PeriodicalUpdater, inserts in realtime as i wanted, but it doesn’t replace the data inside my table here is the html code
<table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<th id="products"></th>
</tr>
</table>
And here is the code for the js
new Ajax.PeriodicalUpdater('products', 'test.php',
{
method: 'get',
insertion: Insertion.Top,
frequency: 1,
decay: 1
}
);
But the result it’s bad, it adds and adds everytime the same data, it doesn’t replace, what im doing wrong?
Well, you’re inserting, so it… inserts.
FYI, Insertion.Top is deprecated in favor of Element#insert, but what you’d want is Element#replace.
However, the default is to replace–by specifying an
insertionproperty you’re overriding the default. See the Updater docs for more details.