title: How do I render dynamic data stored in db for every second in yii
body: <p>I want to know the number of registrations every second. Via AJAX, we retrieve the data on some event e.g., click, but then without clicking  dynamically data should fetched from db. 
  something like it should automatically refresh and get the values.</p>
  
  <p>It fetches on refreshing page or event based but without any of those how do I get the results.</p>
  
  <p>Can this be done? Can anyone guide me on how I can achieve this. I am also not sure what tag I should apply. If I'm not clear please let me know I will elaborate.</p>
  
  <pre><code>  &lt;script&gt;
  
  getFeed();
  
      var auto_refresh = setInterval(
          function ()
     {
       getFeed();
        if (last_timestamp === undefined)
       {
      clearInterval(auto_refresh);
      last_timestamp = -1;
         }
  
     }, (1000 * 60)); // refresh every 60 seconds
  
  
  
   var last_timestamp = 0;
  function getFeed()
  {
  
  
      $.ajax({
          type        : 'GET',
          url         : '&lt;?php echo Yii::app()-&gt;request-&gt;baseUrl;?&gt;/index.php/mycontroller/chart',
          data        : null,
          dataType    : 'html',
          success:function(data){
              $("#chart").html(data);
          },
      });
  
  
  }
       &lt;/script&gt;
  
  
   &lt;div id="chart"&gt;
  
   &lt;/div&gt;
  </code></pre>
  
  <p>The code above doesn't retrieve the result automatically after 60 second. How do I call an action on every second and not on any event or refresh page?</p>