开发者

How can I pass variable with Ajax link in Rails?

I want to pass variable with link_to_remote in Rails 2.3. Following is my code for passing variable. But controller did not get that variable. Anybody can help me开发者_JAVA技巧 ?

<%= link_to_remote 'Add new event', :url => {:controller => 'events', :action => 'new' }, :with=> 'event' %><br>


Any hash key you add that's not part of the keyword set (controller, action, format) will be appended to your URL as an argument.

ie.

<%= link_to_remote "Add New Event", :url => {:controller => 'events', :action => 'new', :var => 'event'} %>

Would yield

/events/new?var=event


Hope this would solve your problem,I have not tried.

<%= link_to_remote "Add New event", :url => :action => "list", :with => " 'name=' +$('div-id-of-name-text-box').value + '&city=' +$('div-id-of-city-text-box').value + '&country=' +$('div-id-of-country-text-box').value " %>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜