PHP Snippet 1:
success: function(response) {
let buffer = '';
for (var i = 0; i < response.length; i++) {
buffer += '<li>'+response[i].name+'</li>';
}
$('.platformsList').html(buffer);
}
PHP Snippet 2:
success: function(response) {
let buffer = '';
for (var i = 0; response.length < i; i++) {
buffer += '<li>'+response[i].name+'</li>';
}
$('.platformsList').html(buffer);
}
PHP Snippet 3:
function platformsList($conn){
$query = "SELECT id, name, slug, icon FROM `platforms` ORDER BY id ASC";
$result = $conn->query($query);
$data = $result->fetch_all(MYSQLI_ASSOC);
return $data;
}
if(isset($_GET['platforms']) AND $_GET['platforms'] == 'platforms'){
$platforms = platformsList($PDO);
echo json_encode($platforms);
}
PHP Snippet 4:
success: function(response) {
for(var i = 0; response.length < i; i++) {
buf += '<li>'+response[i].name+'</li>';
}
$('.platformsList').html(buf);
}