Without refreshing/reloading a complete page, how we can update a news article section that comes from the Aem component or content fragment | Community
Skip to main content
Abhishekty
Level 4
January 17, 2022
Solved

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

  • January 17, 2022
  • 2 replies
  • 1846 views

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? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Varun_Shakya

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.

2 replies

Varun_Shakya
Community Advisor
Varun_ShakyaCommunity AdvisorAccepted solution
Community Advisor
January 17, 2022

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.

Shashi_Mulugu
Community Advisor
Community Advisor
January 18, 2022

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

Abhishekty
Level 4
January 18, 2022