I have a javascript that plays an audiofile from a list of files when a link is clicked. Page is not reloaded and it works fine.. so far. Now i'd like to trigger a sql insert query that will update my database with info on what audiofile was played. Since i use e.preventDefault im not loading any new page hence i cannot trigger a sql run that way. How do i go about this? My page is a mix of php and javascript. Below is the javascript part. Please give me some advice or direction cause i dont know where to start.
function audioPlayer(){
$(document).on("click", "#playlist a", function(e) {
e.preventDefault();
$("#audioPlayer")[0].src = this;
$("#audioPlayer")[0].play();
});
}