• Raghav Sharma 39
  • NEWBIE
  • 30 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 2
    Replies
Ajax call is not stopping by itself . The counter still keeps on incrementing. Can someone please let me know what am I doing wrong here?

VF page code:
<apex:page controller="polarExampleClass">
    <apex:form >
        <apex:outputText value="Watch this counter: {!count}" id="counter"/>
        <apex:actionPoller action="{!incrementCounter}" reRender="counter" interval="5" timeout="10000"/>
    </apex:form>
</apex:page>

Apex class code:
public class polarExampleClass {
Integer count = 0;
            
    public PageReference incrementCounter() {
        count++;
        return null;
    }
            
    public Integer getCount() {
        return count;
    }
}