title: Refresh div with JSON data using JQUERY
body: <p>I know this is a duplicate question but I can't get my specific code to work.</p>
  
  <p>I have a JSON file that has 2 variables in it that I want to display and update every 5 seconds on my page. It works great but as soon as I try and insert a setTimeout or setInterval the data won't display.</p>
  
  <pre><code>&lt;script&gt;   
      $(document).ready(function() {  
          (function request() {
              $.ajax({
                  url: "json.account-balance.php",
                  dataType: "text",
                  cache: false,
                  success: function(data) {
                      var json = $.parseJSON(data);
                      $('#trade_pp').html(json.trade);
                      $('#ect_pp').html(json.ect);
                  }             
              });              
         setTimeout(request, 5000);
           });
      });
  &lt;/script&gt;
  </code></pre>