I have a search box (id=:phrase) on my rails ajax page. I want a periodically call remote poller to update a div whenever the value in that box changes.
On the page containing the search box, I have the following: <%= periodically_call_remote(:url => update_query_topics_url, :with => "$('phrase').serialize()", :frequency => 1.0)%>
I have also tried:
<%= observe_field(:phrase, :url => update_query_topics_url, :with => "$('phrase').serialize()", :frequency => 1.0)%>
The issue is that the phrase value is not picked up when it changes in either case. The update continues to use the first phrase value, unless the page is refreshed.
I also tried assigning the phrase from the rjs on clicking the submit button beside the search box:
page.assign "phrase", @query.phrase
However, the only way to get the periodically_call_remote or the observe_field seems to be to refresh the page.
How do I get the update to happen whenever the phrase changes? I need the poller, because the actual retrieving of topics based on the query will run in a delayed job.