I am having problem with $(".useful-box").on("click", this.ourClickDispatcher.bind(this))
. I am not able to make this code work when I enable the "Paginate using AJAX" option for reviews post type. The problem is because I am unable to like reviews on the 2nd or 3rd page.
Everything works and I am able to like my reviews if I disable the "Paginate using AJAX" feature, however I want to use it.
class Useful {
constructor() {
this.events();
}
events() {
$(".useful-box").on("click", this.ourClickDispatcher.bind(this));
}
ourClickDispatcher(e) {
var currentUsefulBox = $(e.target).closest(".useful-box");
if (currentUsefulBox.attr('data-exists') == 'yes') {
console.log('dy');
this.deleteUseful(currentUsefulBox);
} else {
console.log(currentUsefulBox);
this.createUseful(currentUsefulBox);
}
}
}