Link_to_remote with dynamic textbox


#1

I’m trying to build a custom spell-checker. When an incorrect word is
found, a select list is populated with suggestions, and when a
suggestion is clicked, a “replacement_text” textbox is populated with
the value. I’d like to be able to use a link_to_remote item to update
the item. However, I can’t figure out how to pass the parameter to my
“replace” action in my controller. I’ve tried:

link_to_remote(
    suggest_item,
    :update => "id__#{word_count}",
    :url => {
        :action => 'replace',
        :id => word_count,
        :with => "$('replacement_text').value"
    }

but the literal “$(‘replacement_text’).value” gets submitted rather than
the actual value of the “replacement_text” box.