dynamic link_to_remote in rails with jquery -


I am trying to pass a string with a link_to_remote call as: id, and string an input Should be collected from the field and id of "movie_title".

  & lt; Div id = "search_list" & gt; There is nothing here yet & lt; / Div & gt; & Lt; Br / & gt; & Lt;% semantic_form_for @movie do | F | | & Gt%; & Lt;% f.inputs do -% & gt; & Lt;% = f.input: title ,: class = & gt; "Movie_title"%> & Lt;% = link_to_remote ('Search ...', {: URL = & gt; {: action = & gt ;: imdb_search ,: id = & gt; "'+ $ (' \ # MOVIE_TITLE ') Value + . "}}, {: Title = & gt;" Search for this movie ",: class =>" imdb_search "}) -%> [... deleted text which does not matter ...] <% end -%> & Lt;% = f.buttons% & gt; & Lt;% end% & gt;  

I have a javascript getting error and if I remove the jQuery link #, it returns undefined ""

Links I'm getting .:

  & lt; a class = "imdb_search" href = "#" onclick = "jQuery.ajax ({data: 'authenticity_token =' + encodeURIComponent ( 'yHPHYTZsPTQLi9JYSauUYcoie / pqPPk2uHBTN0PzNsQ ='), datatype: 'script', type:" POST ", url . '/ movies / imdb_search /' + $ ( '% 23movie_title') value + ''}); return false; "title =" Search for the movie "& gt; Search ... & lt; / A & gt;  

So I want the updated link with the contents of the movie_title. How do i do this

I'll try to do something

  & lt;% = link_to_remote ( 'Search ...', {URL = & gt; {: action = & gt ;: imdb_search}: a = & gt; ". 'id =' + $ ( 'MOVIE_TITLE') value" with, {: Title = & gt; "Search for this movie" ,: class => "imdb_search"})  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -