Hello everyone,
Long time no see
I’ve been recently working on a new site:
And i’ve got a few questions, so this topic will represent the first one
When I open developer tools I see I have this warning coming from jQuery:
[Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
I’ve already tried a few different solutions I found online, like:
- Trying to do async:true and putting the code I need inside a success block.
- Trying to use jQuery .get function and then putting the code I needed inside the .done function.
Both these methods removed the warning and caused no other errors, but the countdown timer stopped working.
Here’s a snippet of one of the things I tried:
$(document).ready(function() {
$.get('/timer.php', function(time) {
if (time < new Date().getTime()) {
$('#clock-text').html('Season started since:');
$('#clock').countdown({timestamp: time});
} else {
$('#clock').countdown({timestamp: time, callback: function(left) {
if (left == 0)
$('#clock-text').html('Season started since:');
}});
}
});
});
I tried to print out the variable ‘time’ and it is correct, so I have no idea why the countdown isn’t showing up.
Any hints?
Thanks