conditional ajax call after page is loaded

Hi - I have an app where the user can submit a query and the page gets
updated dynamically. Right now, the user types in a query with a
remote_form_tag. I'd like to add the ability to encode the search
term in the URL itself, so the query is shareable, in addition to
being able to manually type in the query.

Since I already have all of the logic in the javascript code to do the
updating, is it possible to do something like, fire off a call to my
AjaxUpdater if a Ruby variable is set, or something like that upon
rendering the view?

Thanks for any help,

explain the first paragraph better please and the answer to the second question is yes