When a user clicks .play it should add a play count if it doesn't have class alreadyplayed and then add class .alreadyplayed I am new to AJAX and cant seem to make it work.
$(".play").on('click', function () {
if (!$(this).hasClass('alreadyplayed')) {
$.ajax({
type:'post',
url:'addplay.php',
data: songid = $(this).attr('sound_id'),
}).done {
$(this).addClass('alreadyplayed');
}
});
Aucun commentaire:
Enregistrer un commentaire