I have a basic audio player:
I think the problem is that you need to make a request once the current song finished, you can achieve this adding the ended event listener to the audio element:
var audio = $("#player");
audio.addEventListener("ended", function(){
$.post("song.php", function(result){
audio.src = result;
audio.pause();
audio.load();//suspends and restores all audio element
audio.play();
});
});
Note: If you still have problems, include the PHP code in the question and check if your PHP file is getting the proper header