Function does not execute when called from Javascript Interval

In console I see the log every 3 seconds as expected:

check_session_timer = setInterval(function() {
  console.log("this is called");
  anvil.call(this, "check_active_sessions");
}, 3000);  

Nothing is printed here on the server-side:

def check_active_sessions(self):
  print "check_active_sessions is called"

There are no errors.

Check some of the examples regarding using “this” vs $("#tag") as the first argument of anvil.call:

Example 1

Example 2

2 Likes

Selecting an element worked, thank you.