Perform conditional testing on Jquery?

0

I'm doing a page and need to be updated constantly, but only when the value of an external page that I called with the Jquery.get () function is different from what is already contained in the file, follows my jquery code. ..

$(document).ready(function() {
    setInterval(function()
    {
        $.ajaxSetup ({ cache: false });
        $.get("config-stream.php?pegar=musica-atual", function(verifica){

            var musicaAtual = $("#tudo").text();        
            if(verifica != musicaAtual){
                $("#tudo").html(verifica);
            }
        });
    }, 2000);
});

And its HTML ...

<div id="tudo">
    valorinicial
</div>
<p id="oi"></p>
    
asked by anonymous 01.11.2015 / 06:54

0 answers