I'm fetching data using Ajax from the database now I want to loop the response I get from the database, but I'm stuck, have no idea on how I can loop this. Any help would be appreciated.
//This is how I loop using Laravel(I want to loop like this with Ajax)
@foreach(range(1,5) as $i)
@if($total >0)
@if($total >0.5)
<div>Full star</div>
@else
<div >Half star</div>
@endif
@else
<div >Empty star</div>
@endif
<?php $total--; ?>
@endforeach
//This is the response from Ajax which displays total number from database
<span id="mycount"></span>
Ajax
function getCount() {
$.ajax({
type: "GET",
url: '',
success: function(data) {
$('#mycount').html(data);
setTimeout(getCount, 1000);
}
});
}
getCount();
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire