title: I get the error: too much recursion. Why is that?
body: <p>I have a function to refresh graphs on a page. The idea is that it loops constantly and refreshes a variable called <code>salt</code>. Variables are defined in a separate file and are called <code>path</code>, <code>displayTimeFrom</code>, <code>selectedTimeRangeType</code> and <code>target</code>. Here is the looping code which also responds to changes in the GUI:</p>
  
  <pre><code>$(function () {
      refreshGraphs();
  });
  
  var refreshGraphs = function () {
      d = new Date();
  
      var graphiteUrl = graphs.path + "render/?_salt" + d.getTime()
                  + "&amp;from=-" + graphs.displayTimeFrom
                  + graphs.selectedTimeRangeType
                  + "&amp;minXStep=0"
                  + "&amp;until=now&amp;height=800&amp;";
  
      $('#graph-middle').prop("src", graphiteUrl + graphs.target);
  
      setIntervalAndExecute(refreshGraphs, 30000); // refresh every 30000 milliseconds aka every 30 seconds
  
      // Execute immediately and after the interval (setInterval only starts after certain amount of time)
      function setIntervalAndExecute(fn, t) {
          fn();
          return (setInterval(fn, t));
      }
  
      // Change graph to chosen value
      $('#graph-middle').on('click', '#displayTimeFrom', function () {
          graphs.displayTimeFrom = $(this).text();
          refreshGraphs();
      });
  
      $('#graph-middle').on('click', '#selectedTimeRangeType', function () {
          graphs.selectedTimeRangeType = $(this).text();
          refreshGraphs();
      });
  };
  </code></pre>
  
  <p>When I run it it says <code>"too much recursion"</code>. Why is that and how can I solve it?</p>