I'm trying to listen for clicks on the #top, but after loading php using jQuery it doesn't respond. I really hope somebody can help, since this is the only issue that couldn't be resolved by googling it.
Here's the jQuery/javascript:
function change(type, top, user){
var ec = $('.entries-container');
ec.load('load.php', {type: type, top: top, user: user});
}
$(document).ready(function(){
$('.load').on('click', function(event) {
event.preventDefault();
var type = $(this).data('type'),
top = '0';
$('#top').data("current", type);
change(type, top);
});
$('#top').on('click', function(event) {
event.preventDefault();
var data = $(this).data('current');
change(data, data);
});
$('#top').on('click', function() {
console.log('Yes');
});
});
And here's the output of the php page which is loaded:
echo '<div class="entry cf span4 ">';
echo '<div class="entry-img bd-all-green">';
echo '<img class="" src="video/' . $e['v_name'] . '_thumb.jpeg" alt="">';
echo '</div><div class="entry-text cf bg-green txt-white">';
echo '<p class="entry-type">Image</p>';
echo '<p class="entry-votes">Votes: <span>' . $e['v_votes'] . '</span></p></div>';
echo '<p data-id="' . $e['v_id'] . '" data-type="video" class="entry-btn bd-all-green txt-green"><span>Vote</span></p></div>';