Issue Whit Infinite loop in Array

Issue Whit Infinite loop in Array

Hi,
Can you please take a look at following jquery Code and let me know how I can stop infinitive looping inside the program:

  1. $(document).ready(function()
    {
       var comp = new Array("AAPL","MSFT","XRTX&");
       var t = setInterval(function(){getPrice();},2000);

        function getPrice()
        {
                for (var i=0;i<comp.length;i++){
                      $.getJSON('https://finance.google.com/finance/info?client=ig&q='+comp[i]+'&callback=?', function(response){
                            var stockInfo = response[0];
                            var stockString = '<div class="stockprice">';
                            stockString += 'Price is $'+''+stockInfo.l+'';
                            stockString += '</div>';
                                       $('body').append(stockString);  
                            $('.stockprice').replaceWith(stockString);
                     
    $(".stockprice:contains('-')").addClass('red');                      $(".stockprice:contains('+')").addClass('green');
                      });
                }
        }
    });



















As you can see what I am trying to do is getting qutes from Google Finance and rendering them in array of divs(based on    var  comp  new  Array ( "AAPL" , "MSFT" , "XRTX&" ) ;) I also would like to update the divs based on my code on    $ ( '.stockprice' ) . replaceWith ( stockString ) ; which is working fine but the problem is code is generating no stop divs!

Can you please let me know how to fix it

Thanks for ur time