rayrayrugby Posted October 23, 2014 Share Posted October 23, 2014 Hi, I want to run every 10 seconds a php code wich executes a js script in BO. This php code is a part of one of my .tpl div. I know I have to do this using AJAX but I don't really know how to use AJAX in Ps . Could somebody help me please ? Link to comment Share on other sites More sharing options...
Rolige Posted October 23, 2014 Share Posted October 23, 2014 You has created 7 threads for this? Link to comment Share on other sites More sharing options...
rayrayrugby Posted October 23, 2014 Author Share Posted October 23, 2014 excuse me, my browser shut down .. Link to comment Share on other sites More sharing options...
PascalVG Posted October 26, 2014 Share Posted October 26, 2014 Why don't you just run the javascript every 10 seconds, instead of let php initiate it?? window.setInterval(function(){/// call your function here}, 10000); (use clearInterval() to stop it) Or, if you want to run it some fixed amount of times: Make a function: function setIntervalX(callback, delay, repetitions) { var x = 0; var intervalID = window.setInterval(function () { callback(); if (++x === repetitions) { window.clearInterval(intervalID); } }, delay);} and then call using: // This will repeat your logic every 10 seconds for 5 times:setIntervalX(function () { // Your logic goes here}, 10000, 5); Hope this helps, pascal. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now