get html from a div and show them on a other page
i am struggling with the following :
I have a html mainpage , on this page i have a column with a "read more"section , so a 开发者_开发技巧couple of lines tekst from a news message from a html page called News .
when there is new news , i have to update the "read more"section by hand .
Is it possible with Jquery and ajax to update the "read more"section on page load.
maybe you guys have a better way to do something like this , ore is there some $ code i dont know
hope you can help me
Cheers
You can look at loading page fragments using .load()
. Depending on your page's markup, something like this on the main page should work.
// Grab the first div in the #news element on
// the news.html page and jam it into #recent
$('#recent').load('/news.html #news div:first');
Demo: jsfiddle.net/SLx9c
精彩评论