Here's a basic example using PrototypeJS.
new Ajax.Updater('containerId', '/url/to/get/content', {
parameters: { somename: 'somevalue' }
});
- The first argument is the ID of the container to put the result of the Ajax call in.
- The second argument is the URL to send the request to
- The third argument, in its most basic form, is the list of parameters to send to the URL.
For more details about the Prototype Ajax request, check out the Ajax.Request documentation.
Taking a page from Jonathan's nice jQuery answer, here's how you'd execute the Ajax request on a timer using Prototype's PeriodicalExecuter.
new PeriodicalExecuter(function(pe) {
new Ajax.Updater('containerId', '/url/to/get/content', {
parameters: { somename: 'somevalue' }
});
}, 30);