setinterval says not defined function but it is

≡放荡痞女 提交于 2019-12-02 05:20:37

Put your code in an separate <script> tag. As soon as a <script> tag has a src attribute, any content of that tag is ignored in favor of the given resource. so just do this:

<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script>
function live() {
    $.get("http://mydomain.com/script.php", function(data){
        var timer = data;
        var elm = document.getElementById("live");
        if (timer == 1){
         elm.style.display = 'block';
        } else{
         elm.style.display = 'none';
        }     
    });
}
</script>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!