XF 2.2 Locate example code to page update when data updated (thread view page)

Earl

Well-known member
Just like in the thread view page, when someone adds a reply, we can see a small message that new posts have been added.

Where to locate this code?

My add-on has a different page. I need to update that page when some data is received in the database, without the user hitting the refresh button.
 
It happens as part of the draft save system, see \XF\Pub\Controller\ThreadController::actionDraft.
oh, it seems like this div block js-newMessagesIndicator pops out only when a message is being typed.

I am trying to develop an account activation system in which some data gets updated via API calls, and I want to refresh a special page that is only allowed to be viewed by a specific user when the data has been changed.

Can you suggest any existing example code I should check for this auto page update case?
 
Not off the top of my head, but if you’re comfortable writing your own JS handler it’s pretty straight-forward to call XF.ajax in an interval and then XF.setupHtmlInsert the response, which is what most AJAX handling boils down to.
 
Back
Top Bottom