简体   繁体   中英

How to pull contents from a page into small div section of existing page in ruby on rails?

I have a list of links on a page:

                                       PAGE 1

Link.1

Link.2

Link.3

Link.4

Etc.

I want to make it possible for a user to click a link eg link 2 perhaps.. and have the contents of that page (that is stored in it's own file) to show up on the same page with out the page refreshing.

I would basically pull the contents into a div on the page. When ever another link is clicked I would like for the present content to disappear making room for the new content.

This kind of thing is NEW to me. I would appreciate if anyone could point me towards a tutorial which clearly shows how to do this.

I previously posted this question and there were some good links but this is totally new to me and the examples seemed quite confusing.

Thanks in advance

you can use .load

<div id="link2container"></div>

jquery

$("#link2ID").click(function(e){
$("#link2container").load("page2.html");
});

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