简体   繁体   中英

setInterval doesn't work in firefox

I have a problem with setInterval function in Firefox, it works well in chrome, can someone explains my why? This is the code.

<html>
<head>
<!-- desde http://www.aaronjwhite.org/index.php/15-web-development/jquery/7-using-jquery-and-google-finance-to-create-a-simple-stock-ticker -->
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<title>Prueba Google Finance</title>
<script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
<script type="text/javascript">
var count=0;
$(document).ready(function call(){
    $.getJSON('https://finance.google.com/finance/info?client=ig&q=MSE:IDR&callback=?',function(response){
    var stockInfo = response[0];
    var stockString ='<div class="stockWrapper">STOCK:';
        stockString +='<span class="stockSymbol">'+stockInfo.t+'</span>';
        stockString +='<span class="stockPrice">'+stockInfo.l+'</span>';
        stockString +='<span class="stockChange">'+stockInfo.c+'</span>';
        stockString +='<span>at</span> <span class="stockTime">'+stockInfo.ltt+'</span>';
    stockString +='</div>';
    $('.stockTick').prepend(stockString);
    count++;
    alert("Call nº "+count);
    setInterval(call,20000);
    });

});

</script>
</head>
<body>
<div class="stockTick">Auto20</div>
</body>
</html>

It seem to do not work in Chrome too.

Failed to load resource: the server responded with a status of 400 ()

Your api return a 400. So that code is not working

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM