-1

How I can update page content without reloading page in Laravel 5.1 every 1 sec for all users.

My View:

I want to refresh data without reload page but I use loop foreach and I don't know How i can do this.

     @foreach ($aukcje as $aukcja)  
        <div class="text-center col-md-4" style="padding:0px;margin-top:20px;">
            <div class="classWithPad">
            <center>
            <img src="{{$aukcja['img']}}" width="124px">
            </center>
            <div class="wystawil">
              <div class="wystawil_ikona">
              <span class="glyphicon glyphicon-user"></span>
              </div>
              <div class="wystawil_tekst">Przedmiot wystawił:<b> {{$aukcja['nick']}}</b></div>
            </div>
            <div class="podbicia">
              <div class="podbicia_ikona">
              <span class="glyphicon glyphicon-stats"></span>
              </div>
              <div class="podbicia_tekst" id="{{ $aukcja['items_id'] }}">Ilość podbić:<b> {{$aukcja['podbicia']}}</b></div>
            </div>
            <div class="czas">
              <div class="czas_ikona">
              <span class="glyphicon glyphicon-time"></span>
              </div>
              <div class="czas_tekst">Czas do końca:<b> {{$aukcja['czas']}}</b></div>
            </div>


            <button type="button" value="{{$aukcja['items_id']}}" id="{{ url('/steam/podbij/'.$aukcja['items_id'])}}" class="btn btn-default podbij" >Podbij</button>    
        </div>
    </div>
   @endforeach
Jensej
  • 1,255
  • 6
  • 21
  • 33
  • possible duplicate of [jQuery Ajax request every 30 seconds](http://stackoverflow.com/questions/4450579/jquery-ajax-request-every-30-seconds) – Mihkel Allorg Sep 14 '15 at 19:03
  • Why on earth would you want to reload content _every_ second? Not only would this not be long enough for your users to read anything before it was flashed and replaced with something new, but you’re probably going to trigger epileptic fits in some, or at least bad headaches. – Martin Bean Sep 14 '15 at 22:16
  • it's auction and every bid should be able to see for all users. Maybe You have better solution? – Jensej Sep 14 '15 at 22:26

1 Answers1

0

You should look into AJAX, JQuery. It's basically making requests to server without reloading the page.

EDIT:

Take a look at this, it's answered here:

jQuery Ajax request every 30 seconds

Community
  • 1
  • 1
Mihkel Allorg
  • 929
  • 1
  • 8
  • 26