# Conditional ajax call after page is loaded

**URL:** <https://www.ruby-forum.com/t/conditional-ajax-call-after-page-is-loaded/194727>\
**Category:** Rails\
**Created:** [September 9, 2010, 4:55pm UTC](https://www.ruby-forum.com/t/conditional-ajax-call-after-page-is-loaded/194727 "2010-09-09T16:55:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dino\_d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dino\_d](https://www.ruby-forum.com/u/dino_d)\
**Post date:** [September 9, 2010, 4:55pm UTC](https://www.ruby-forum.com/t/conditional-ajax-call-after-page-is-loaded/194727/1 "2010-09-09T16:55:10Z")

</div>

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,  
Dino

---

<div class="post-metadata">

**Author:** ![dino\_d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dino\_d](https://www.ruby-forum.com/u/dino_d)\
**Post date:** [September 9, 2010, 5:26pm UTC](https://www.ruby-forum.com/t/conditional-ajax-call-after-page-is-loaded/194727/2 "2010-09-09T17:26:48Z")

</div>

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