Python Forum
gettin flask to call script periodically
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
gettin flask to call script periodically
#1
As in the title I want a script to get called periodically
I have this script at the bottom of an html file
<script>
setInterval("ajaxd()",1000);
function ajaxd() {
$(document).ready(function(){alert("ready");})
}
</script>
but the alert is not called
Is the syntax correct?
Reply
#2
Why are you passing a string to setInterval instead of just passing the function (per the documentation)? That is

setInterval(ajaxd, 1000);

Functions have been first class in JavaScript for a long time and you make use of that when you call jQuery's ready method.

Also, did you remember to check the browser's console for errors?

Note also this has nothing to do with the server; this code is only executed in the browser.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Connecting python script into HTML with flask Piqurs 1 16,049 Sep-05-2018, 08:24 PM
Last Post: snippsat
  unable to call function in Flask verb 5 18,277 Sep-29-2016, 02:27 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020