title: Refreshing a div every 30 second with JavaScript
body: <p>I'm trying to automatically update a div every 30 seconds.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
      function refresh_handler() {
          function refresh() {
             $.get('/refresh/3', function(result) {
                 $(".roek").innerHtml = result;
                 console.log(result);
             });
          }
          setInterval(refresh, 3000); //every 5 minutes
      }
  
      $(document).ready(refresh_handler);
  
  &lt;/script&gt;
  </code></pre>
  
  <p>Here I'm trying to refresh the div every 30 seconds.</p>
  
  <pre><code>&lt;div class="col-md-12"&gt;
      &lt;div class="roek"&gt;
          @foreach ($hours as $hour)
              @if ($hour-&gt;repeat_day === "Monday")
                  &lt;p&gt;
                      &lt;div class="col-md-3"&gt;
                          &lt;b&gt; Day: &lt;/b&gt; {{ $hour-&gt;repeat_day }} &lt;a href="/deletehour/{{ $hour-&gt;id }}"&gt; &lt;span class="glyphicon glyphicon-info-sign" aria-hidden="true" style="color: cyan"&gt;&lt;/span&gt;&lt;/a&gt; &lt;br&gt;
  
                          &lt;b&gt; Start: &lt;/b&gt; {{ strftime("%H:%M", strtotime($hour-&gt;starttime))}} &lt;br&gt;
                          &lt;b&gt; End: &lt;/b&gt; {{ strftime("%H:%M", strtotime($hour-&gt;endtime))}} &lt;br&gt;
                      &lt;/div&gt;
                  &lt;/p&gt;
              @endif
          @endforeach
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Currently it's trying to refresh the Div but it doesn't update it on the refresh.
  In my <code>web.php</code> I have the following:</p>
  
  <pre><code>Route::get('/refresh/{id}', 'RefreshController@workhoursrefresh');
  </code></pre>
  
  <p>And this is the query I'm using after the refresh:</p>
  
  <pre><code>//show all standard workhours per specific user
  public function workhoursrefresh()
  {
      $hours = Availability::FindAvailabilitys()-&gt;where([['user_id', '=', Auth::id()],
                                                         ['type', '=', 'standard']])
                                                -&gt;orderBy('starttime', 'asc')
                                                -&gt;get();
  }
  </code></pre>