开发者

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

开发者 https://www.devze.com 2023-03-29 15:22 出处:网络
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 e.g. link 2 perhaps.. and have the contents of that page (that i

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 e.g. 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");
});
0

精彩评论

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