Boot does not work in SetInterval

0

Opa,

I have a set interval:

$(document).ready(function(){
    setInterval(function() {
        $("#loading_questions").load("include/question.php?id_question=1");
    }, 8000);
});

Inside the question.php file I have a button with a certain class, which when triggered calls a javascript function. What I want to know is if there is any kind of lock in a setinterval when calling a javascript function by onclick or by class.

Vlw

    
asked by anonymous 04.04.2016 / 19:05

1 answer

0

You need to reload the event after loading. You can automate this using .on() .

Then substitute something like this in your script:

$("<selector do botão>").click(function (event) { ... })
//ou
$("<selector do botão>").on("click", function (event) { ... })

by the following:

$("#loading_questions").on("click", "<selector do botão>", function (event) { ... })
    
04.04.2016 / 19:28