I'm trying to create a script for when the person clicks on Like it will enjoy the post, and when you click on Descortir, you will discard the post, of course, I managed to do it successfully, however I had to do this by putting the jquery script in the PHP, causing each result, a new script to be created, that would be very large. I wanted to leave only 1 code, how do I get the IDS there in the case of dynamic results?
I'll explain briefly, why it got a bit confusing, I want to instead of having to put this javascript in dynamic select, put only 1 code for everyone.
JQUERY
$(document).ready(function(){
// like and unlike click
$("#like<?php echo $row['idd']; ?>, #unlike<?php echo $row['idd']; ?>").click(function(){
var iconCarregando = $('<img src="loading.gif" width="70"> arregando. Por favor aguarde...');
$('#statuslike<?php echo $row['idd']; ?>').html(iconCarregando);
$.ajax({
type: "GET",
url: 'acoes.php?like=1&id=<?php echo $row['idd']; ?>',
success: function(data){
$(iconCarregando).remove();
} });
});
});
HTML
(the code is in half, why can not I put the whole code)
a href="javascript:void(0);" id="like'.$msg_id.'" title="Like" rel="Like"><i class="fa fa-hand-peace-o margin-r-5"></i> Aplaudir