I'm using the circliful jQuery plug in and I'm wanting to populate it with JSON data. The first div loads the data whereas the rest don't load anything at all.
I've tried multiple ways but nothing seems to be working for me, they either all filled with 0%, nothing at all or just the first div as mentioned above.
<div class="grid">
<!-- ajax content loaded into this div -->
</div>
<!--json file format-->
[
{
"id": 1,
"full_name": "Ignacius Antos",
"email": "iantos0@jigsy.com",
"password": "FK4umZJ9eh",
"profile_picture": "https://i.pravatar.cc/255?img=5",
"list_of_items_bought": "",
"rating": "25",
"time_spent": "15"
},
{
"id": 2,
"full_name": "Anallise Ousley",
"email": "aousley1@yellowbook.com",
"password": "5fLR4WhC",
"profile_picture": "https://i.pravatar.cc/255?img=56",
"list_of_items_bought": "",
"rating": "30",
"time_spent": "30"
},
<!--script that loads data from json file-->
<script>
$(document).ready(function() {
$.ajax({
type: "Get",
dataType: "json",
url: "users.json",
success: function(data) {
var profile_data = '';
$.each(data, function(key, value){
profile_data += '<div class="user">';
profile_data += '<a href="#"><img src='+value.profile_picture+'></img></a>';
profile_data += '<h3>'+value.full_name+'</h3>';
profile_data += '</div>';
profile_data += '<div class="grid-item grid-item--width3 grid-item--height3" id="myStat" data-animation="1" data-animationStep="3" data-percent="' + value.rating + '"></div>'; <!-- this is where the json is called ->>
});
$('.grid').append(profile_data);
}
});
<< this is the script that loads the jQuery plug in but only shows for one div and not the rest of the others >>
$( document ).ready(function(data) {
$("#myStat").circliful({
});
});
});
</script>
I think the part I'm getting wrong is the #myStat part of the function I'm not sure. Any ideas would be great