How do I make an Ajax call when a page loads?

Hi all,

I have a view in which periodically_call_remote is updating a partial every 5 seconds. Actually, the updating is getting done in an rjs which also calls effect.highlight (via visual_effect :highlight) on table elements that have a certain CSS class assigned to them. I would like this Effect.Highlight functionality to occur on page load as well as every 5 seconds, so I want to make an extra call to the same action that is currently getting called by the periodically_call_remote statement.

What is the best way to make an Ajax call as soon as the page has loaded?

Thanks in advance!


Have never done it, but I'm guessing that you could do:

<body onload="new Ajax.Request('/path/you/want/to/call')">