0
I made a code listing database items with PHP (using data-id for jQuery to "read" the click), but when filtering the items using Ajax, click stops working.
PHP
while ($furni = $furnis->fetch_assoc()) {
echo '<img src="./web-gallery/images/furnis/small_' . $furni['image'] . '" data-id="'.$furni['id'].'" />';
}
jQuery (in full: http://pastebin.com/BvAz0CRr)
success: function (e) {
$(".small_items").html('');
for (var i = 0; i < e.array.length; i++) {
$(".small_items").append('<img src="./web-gallery/images/furnis/small_' + e.array[i].image + '" data-id="' + e.array[i].id + '" />');
}
}
Explaining better, I have another function using . click to get the data of the item and as I said, listed by PHP o . click works normally, but when it filters and lists by jQuery, the . click stops working
Have you tried using the
.on
instead of.click
? Take a look in that question, maybe it’ll help you.– Felipe Avelar
I was using the . on, but without separating the selector, thanks for the link! it worked :D
– user11653