]> git.nbdom.net Git - nb.git/commitdiff
jQuery.fn.href2delete pass vars with indexValue
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 13 May 2023 17:01:40 +0000 (19:01 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 13 May 2023 17:01:40 +0000 (19:01 +0200)
lib/js/nb.js

index e2db5637521889e6dee8479454634d78a2a411c8..cd4a28ded1fe19c8a29e7f0b99d92d4b761a2d53 100644 (file)
@@ -637,20 +637,19 @@ jQuery.fn.href2delete = function(minus_one,minus_one_re) {
 
                $(this).click(function(){
                        $(this).addClass('loading');
-                       // NB 13.05.23 $(this).parent().parent().remove();
                        $.ajax({
                                url: href,
                                type: 'GET',
+                               indexValue: {item: this, href: href},
                                success: function(result) {
                                        if (minus_one) $(minus_one).numAdd(-1,minus_one_re);
-                                       $(this).parent().parent().remove();
-                                       $(this).removeClass('loading');
+                                       $(this.indexValue.item).parent().parent().remove();
                                },
                                error: function (xhr, status, error) {
-                                       $(this).removeClass('loading');
-                                 alert(status+' '+xhr.status+' '+error);
+                                 alert(status+' '+xhr.status+' '+error+'\n'+href);
+                                       $(this.indexValue.item).removeClass('loading');
                                }
-                       });
+                       })
                });
        });
 }