• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 2.0 How do I update without screen refresh. AJAX / JS ?

arms

Active member
#1
Looking for a little guidance.

I have 2 actions ( thumbup and thumbdown) and a score which is held on the thread table and works on the thread view as it returns return $this->redirect($this->buildLink('threads', $thread));

I want the same functionality on the thread list view and so would need to update without doing a screen refresh as my current version refreshes and moves to top of list. I've looked through XF2, and can't find any similar functionality.

Could anyone point me in the right direction?
 

Siropu

Well-known member
#2
Look for data-xf-click attribute and XF.Click.register JS method. The default thread like action is the best example.
 

AndrewSimm

Active member
#3
It would be super helpful if someone would post some example code and walk through it. I can handle the PHP, but struggle with AJAX, and I think a lot of others are in the same position. I know it's asking a lot, but searching this forum I find a lot of question on how to use AJAX to update the page, but the answer typically has you look at a different file. :)