Duplicates images and other info $.each
Hi, I'm recieving info from steam api and everything works good until I need to display the data using jquery. As u can see in this photo the 3 avatars are displayed. But in each column should be only one avatar, not all three.
Also as u can see the "STEAM nuoroda" repeats 3 times also.
This is my html code:
- <div class="profiles col-md-4">
-
- <div class='userinfo'>
-
- </div>
- <p>Slapyvardis: <strong><span class="personaname"></span></strong></p>
- <p>Steam URL: <strong><span class="steamProfile"></span></strong></p>
- <p style="font-family: 'Roboto', sans-serif;"><button id="reason" data-toggle="modal" data-target="#reasonText{{$s->id}}" class="btn btn-danger"><i class="glyphicon glyphicon-film"></i> Rodyti priežastį</button>
- <button data-toggle="modal" data-target="#proofText{{$s->id}}" id="proof" class="btn btn-success">
- <i class="glyphicon glyphicon-camera"></i> <strong>Įrodymai</strong></button>
- <form id="voteUp" action="/minus-rep/{{$s->id}}" method="get">
- <button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-thumbs-down"></i> <strong>Nerekomenduoti</strong></button>
- </form>
- </p>
- </div>
The app.js:
- $(document).ready(function(){
- $.getJSON("/info.php", function(json){
- $.each(json, function(i, player){
- $('.userinfo').append('<img style="width: 100px; height: 100px" style="width: 100px; height: 100px" src="'+player.response.players[0].avatarfull+'">');
- $(".steamProfile").append('<a href="'+player.response.players[0].profileurl+'">STEAM nuoroda</a>');
- $(".personaname").append(player.response.players[0].personaname);
- });
-
- });
- });