简体   繁体   中英

how to pass the value to jquery from views in rails?

I have a requirement where i need to show the new form in the same window where we have listed the items and also the edit form in the same page. I have run

rails generate scaffold Item name:string

which by default created all that is needed and now i made use of jquery to show the new form in the index page itself on clicking a text but how can i make the edit form to appear in the same page. What i need to know is how can i send the id on clicking to jquery and get the form populated with the value. Please help me.

I will suggest you should try inline editing RailsCast : InlineEditing . Rather than going for jquery and ajax manually.

And for same page having new form : Using Ajax With RJS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM