Here is a basic example using PrototypeJS .
new Ajax.Updater('containerId', '/url/to/get/content', { parameters: { somename: 'somevalue' } });
- The first argument is the identifier of the container in which the result of the Ajax call is placed.
- The second argument is the URL to send the request to
- The third argument in its most basic form is a list of parameters for sending the URL.
For more information on the Prototype Ajax request, see the Ajax.Request documentation.
Taking a page from Jonathan's good jQuery answer, here's how you should execute an Ajax request on a timer using Prototype PeriodicalExecuter .
new PeriodicalExecuter(function(pe) { new Ajax.Updater('containerId', '/url/to/get/content', { parameters: { somename: 'somevalue' } }); }, 30);
Mark biek
source share