let busy = false; // чтобы не накладывать запросы друг на друга
setInterval(function() {
if (busy) { return; }
busy = true;
$.ajax({
...
success: function (data) {
...
busy = false;
},
error: function (r) {
...
busy = false;
}
});
}, 5000);
(function load() {
$.ajax({
...
success: function (data) {
...
setTimeout(load, 5000);
},
error: function (r) {
...
setTimeout(load, 5000);
}
});
})();
$(document).ready(function () {
$.ajax({
url: 'json_input_url',
data: {},
dataType: "json",
cache: false,
success: function (data) {
console.log(data); // увидеть в консоли, что реально пришло
data.forEach(function (val, i) {
var tr = "<tr>" +
"<td>" + (i + 1) + "</td>" +
"<td>" + val.id + "</td>" +
"</tr>";
$('#items').append(tr);
});
}
});
});
result = [
2.936, 2.975, 2.936, 3.024, 3.025, 3.028, 2.98, 2.942,
3.028, 3.035, 3.036, 3.038, 2.95, 3.096, 3.12, 3.28,
3.22, 3.076, 3.075, 3.115, 3.116, 3.175, 3.08, 3.118,
3.24, 3.176, 2.904, 3.028, 2.86, 2.944, 2.948, 2.964,
2.965, 2.955, 2.975, 3.012, 3.025, 3.028, 3.03, 3.075,
2.99, 2.992, 3.008, 3.096, 3.11, 3.025, 3.03, 3.032,
3.04, 3.048, 3.05, 3.052, 3.056, 3.062, 3.064, 2.87,
2.95, 2.952, 2.955, 2.956, 2.958, 2.988, 2.99, 2.988,
2.992, 2.995, 2.996, 2.995, 2.99, 2.998, 3, 3.004,
3.002, 2.978, 2.98, 3, 3.005, 3.052, 3.04
].reduce((p, c, i, a) => i ? Math.max(p, 100 * Math.abs(c - a[i - 1]) / Math.max(c, a[i - 1])) : 0);
SELECT COUNT(pit.id) AS count, MAX(p.name) AS name
FROM Passenger AS p
LEFT JOIN Pass_in_trip AS pit ON p.id = pit.passenger
GROUP BY p.id
SELECT (SELECT COUNT(pit.id) FROM Pass_in_trip AS pit WHERE p.id = pit.passenger) AS count, p.name
FROM Passenger AS p