Я работаю над таймером обратного отсчета jquery / php, и вывод не такой, как ожидалось
Вот код ниже
<p id='FeedExpire-".$id."' class='FeedExpire' style='display:inline-block;'>".$expires_by_cleaned_new."</p>
Подбираем содержимое innerhtml тега ap и запускаемэто в цикле, чтобы отобразить таймер обратного отсчета для каждого элемента в jquery
var x = setInterval(function() {
$('.FeedExpire').each(function () {
alert(document.querySelector('#'+this.id).innerHTML);
var deadline = new Date(document.querySelector('#'+this.id).innerHTML).getTime();
});
Но не получая результат, как ожидалось. Я получаю ожидаемые результаты, и он меняется мгновенно (скриншоты ниже)
Полный код ниже
Ожидаемый результат

Ошибка

$( document ).ready(function() {
$.ajax({
type: "POST",
url: "http://192.168.1.11/Retrivedataforhomefeed.php",
//data: {email:email,userId:userId,displayName:displayName,givenName:givenName,},
cache: false,
success: function(data) {
var results=data;
document.querySelector('.Homefeedstart').innerHTML = results;
//alert(document.getElementsById('DBPostExpireBy-1').innerHTML);
var x = setInterval(function() {
$('.FeedExpire').each(function () {
alert(document.querySelector('#'+this.id).innerHTML);
var deadline = new Date(document.querySelector('#'+this.id).innerHTML).getTime();
var now = new Date().getTime();
var t = deadline - now;
var days = Math.floor(t / (1000 * 60 * 60 * 24));
var hours = Math.floor((t%(1000 * 60 * 60 * 24))/(1000 * 60 * 60));
var minutes = Math.floor((t % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((t % (1000 * 60)) / 1000);
document.getElementById(this.id).innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s ";
if (t < 0) {
clearInterval(x);
document.getElementById(this.id).innerHTML = "EXPIRED";
}
});
}, 1000);
//});
//var FeedDatareturned=$(".FeedExpire").attr('id');
//alert(FeedDatareturned);
}
});
});
<?php
header('Access-Control-Allow-Headers: X-Requested-With, origin, content-type,');
header("Access-Control-Allow-Origin: *");
include("DatabaseConnection.php");
$sql = $dbh->prepare("SELECT * FROM user_posted_data");
$sql->execute();
$row = $sql->fetchAll(PDO::FETCH_ASSOC);
$terms = array();
foreach($row as $output) {
$id=$output['Id'];
$user_comment = $output['User_comment'];
$expires_by =$output['Post_expires_by'];
$expires_by_cleaned = substr($expires_by, 3);
$expires_by_cleaned_new= substr($expires_by_cleaned, 0, strpos($expires_by_cleaned, 'GMT'));
$Posted_by = $output['Posted_by'];
echo"
<div class='FeedBox' id='FeedBox-".$id."'>
<img src='img/report.jpg' id='FeedReport-".$id."' alt='Avatar' width='50px' height='50px' style='float:right;'>
<img src='img/img_avatar.png' id='FeedImage-".$id."' alt='Avatar' width='50px' height='50px' style='border-radius: 50%;padding-top:10px;padding-left:5px;'>
<div id='FeedHeader-".$id."' class='FeedHeader'>".$Posted_by."</div> <div id='FeedRadius-".$id."'>Within:100 meters</div>
<div class='UserComment' id='Data-".$id."'>".$user_comment."</div>
<div id='HelpExpireText-".$id."' style='display:inline-block;'>lend a hand by:</div><div class='DBPostExpireBy' id='DBPostExpireBy-".$id."' style='display:none;'>".$expires_by_cleaned_new."</div><p id='FeedExpire-".$id."' class='FeedExpire' style='display:inline-block;'></p><div class='ReadMore' id='ReadMore-".$id."' style='display:inline-block;float:right;padding-top:16px;padding-right:5px;' onclick='Nextpage(this);'>Discuss</div></div>";
}
?>
Не уверен, где я иду не так, пожалуйста, сообщите
Console.log (крайний срок) скриншот ниже
