Expand my Community achievements bar.

SOLVED

Without refreshing/reloading a complete page, how we can update a news article section that comes from the Aem component or content fragment

Avatar

Level 4

Hi, 

 

I have a news home page and it has multiple sections one of them is today’s latest news headlines. 

I want to implement this section in this way, if any new headlines will change then "latest news headlines" that content should update on the page also without refreshing/reloading a complete page. 

do I need to add an event listener, maintain the session, or need to use time intervals?

 

Can someone suggest me best approach for this? 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

You can write a servlet which will give you latest headlines, and call that servlet at regular intervals of time according to your requirement.

 

once you got the response , change the DOM accordingly.

 

Jquery functions are there to delete the DOM elements and then append again with new response

 

triggering servlet at regular intervals, m sure some jQuery function will be there to do that.

 

There could be others way to implement this. This one could be simple more traditional way to do this.

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

You can write a servlet which will give you latest headlines, and call that servlet at regular intervals of time according to your requirement.

 

once you got the response , change the DOM accordingly.

 

Jquery functions are there to delete the DOM elements and then append again with new response

 

triggering servlet at regular intervals, m sure some jQuery function will be there to do that.

 

There could be others way to implement this. This one could be simple more traditional way to do this.

Avatar

Community Advisor

@Abhishekty Use any FE framework to achieve this.. there are many ways to achieve a partial DOM refresh without need of page refresh.