JQuery call not called

I am using the .postAJAX method for jQuery:

// completion toggling
$('.item input').click(function() {
    $.post('complete.php', {item: this.id}, function() {
        $(this).parent().fadeOut('slow');
    });
});

What am I doing wrong here? AJAX works when a record is updated, but the callback event never occurs. There are no errors in Firebug either.

+3
source share
1 answer

I wonder if this is different from this "this". Try using capture:

$('.item input').click(function() {
    var tmp = this;
    $.post('complete.php', {item: this.id}, function() {
        $(tmp).parent().fadeOut('slow');
    });
});
+3
source

Source: https://habr.com/ru/post/1705514/


All Articles