I'm trying to create a new div every second with a prefilled data from the array list.
fields.php:
<?php
$file = fopen('names.csv', 'r');
while (($line = fgetcsv($file)) !== FALSE) {
//$line is an array of the csv elements
$names = $line;
echo $names[array_rand($names)];
}
fclose($file);
?>
JS:
<script>
function createName(){
var feedback = $.ajax({
type: "POST",
url: "fields.php",
async: false
}).complete(function(){
setTimeout(function(){get_fb_complete();}, 1000);
}).responseText;
$('.content').html(feedback);
}
$(function(){
createName();
});
</script>
And the Div I want to be created with the data from the arrays:
<div class="content">
<div class="col-1">
<div class="profile-bg">
<div class="inside-profile">
<img src="img/avatars/avatar1.jpg" class="img-circle" border="0"></img>
</div>
</div>
</div>
<div class="col-2">
<div class="details">
<p style="font-size: 18px;"> ==*I want to show an ARRAY here.== </p>
<p class="details-desc"> ==*(TIMESTAMP, something like: 1m to show when this div was created)== </p>
</div>
</div>
<div class="col-3">
<img src="img/userImg/userImg1.jpg" class="viewed-img" border="0"></img>
</div>
</div>
<div class="col-4">
<div class="seperator"></div>
</div>
</div>
How to transform each ARRAY created in fields.php into a .content
DIV?