How to call api again after clearing interval
<p>I am trying to create a stack area graph from the values I get from api's.
My first api gives me a range of dates. Eg: June 1 - June 7.
My second api gives me values need for the graph. The data looks like this</p>

<p>My idea is to call the api and push the count values to function every time to a function. But somehow I could not make that possible so I am calling api once for every 100 ms and grabbing all the data and triggering the graph. Now when I want to call the second api after one iteration is complete the call interrupts the graph. Please help me fix this. </p>

<pre><code> d3.json('/service/dates', function(error, dates) {
    var dran = dates;
    if (dates != null) {
      sDt = new Date(dates.st);
      eDt = new Date(dates.et);
      var i = 0;
      var start = function() {
        if (sDt &gt; eDt) {
          clearInterval(interval);
          $('.wrapper').trigger('newPoint');
          return;
        }
        var sDate = sDt.toISOString();
        var eDate = new Date(sDt.setMinutes(sDt.getMinutes() + 30)).toISOString();

        //Calling the api for graph values
        d3.json("/service/dat?s=" + sDate + "&amp;e=" + eDate, function(error, results) {
          if (results != null) {

            numbers = numbers.push(results.numbers);
            values = values.push(results.values);
          }
        });
        i++;
      }
      var interval = setInterval(start, 100);
    }
  });
}
</code></pre>