Good morning,
I understand that you can not perform an SQL query from Javascript, but I do not know if the information I have found through Google may be obsolete or not. The fact is that I have some elements that when pressed, a small script is executed:
var heart = 0;
$('#heart').click(function(){
console.log(heart);
if (heart == 0) {
document.getElementById('heart').style.color = '#e74c3c ';
document.getElementById('heart').style.background = 'transparent';
heart = 1;
} else {
document.getElementById('heart').style.color = 'white';
document.getElementById('heart').style.background = '#5dc21e';
heart = 0;
}
});
What I would like is that I not only change the styles, I also insert some data in a table in the database or remove them.
With onclick
I understand that I can not do what I want either because it would also take me to a script.
I can not think of how to solve the problem.
I would appreciate any help.