Problem timers js

Asked

Viewed 51 times

0

I have a web application and this one has Paginaprincipal, Paginaentidade and Paginanoticia and each of these is associated with a JS file. The goal is to start in the paginaPrincipal and past x time go to the paginaEntity and past x time go to the paginaNoticia. I used JS setInterval and it works but with a problem, as it loads the pages it is always loading the script again and then it is always running the timer... Some solution to solve this ?

  • Are the three pages independent? I mean, do you really have to reload the page? You can change the url to have a token/query string that the script looks for and blocks. Flag type saying you have already run.

  • One more detail, then I also need to do the reverse way, ie paginaNoticia, paginaEntidade, paginaPrincipal. So I don’t know if this solution works. What the application does is to simulate a click on a button of the pagePrincipal page and the next page (pageEntity) is built with the data corresponding to the button that was clicked

1 answer

1

I believe you can do different. Create a page and load the content via ajax requests. http://api.jquery.com/jquery.ajax/

You can upload content within a div, for example. The timer can request these changes.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.