简体   繁体   English

来自另一页的ajax部分加载

[英]ajax partial load from another page

So what I want to do is load only a section of one webpage onto another page. 因此,我想做的只是将一个网页的一部分加载到另一页上。 So I want to grab the content of a page (stuff inbetween a div with a certain id) without the headers and footers. 因此,我想获取页面的内容(具有特定ID的div之间的内容)而没有页眉和页脚。 I know I've seen this before but its, stangly, a hard thing to find. 我知道我以前见过,但从某种意义上说,这很难找到。

Anyone kind enough to point me in the right direction? 有足够的好心为我指出正确的方向吗?

thank you 谢谢

You can use the jquery's load method for that. 您可以为此使用jquery的load方法。

$('#result').load('test.html #container');

This will load contents of element having id container from test.html page into current page and inside the element with id result . 这会将具有id container的元素的内容从test.html页面加载到当前页面中,并在具有id result的元素内部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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