I have a code, and code work, but the sounds always running / play, I hope the sounds just once playing if there is a new data entry, but can not. I hope my friends can help me. thnk
function notification(){
$('<audio id="chatAudio"><source src="../sound/notify.ogg" type="audio/ogg"><source
src="../sound/notify.mp3" type="audio/mpeg"><source src="../sound/notify.wav"
type="audio/wav"></audio>').appendTo('body');
$.ajax({
url:"check.php",
chace: false,
success: function(data){
if(data == 0){
$(".place").hide();
}else{
$(".place").show("fast");
$(".place").html(data);
$('#chatAudio')[0].play();
}
}
}).always(function(){
setTimeout(function(){notification()}, 3000);
});
}
$(document).ready(function(){
notification();
});