Search code examples
javascriptajaxjqueryalertify

Using alertify with ajax delete


I was using the default confirm box to delete a record with ajax and it worked proberly. here is the working code http://pastebin.com/HZxDVAgU But when I userd alertify it deletes the record but without hiding it. here is the non-working code http://pastebin.com/7q1sH5gM

that is the code which hides the record

  $(this).parents(".record").animate({ backgroundColor: "#fbc7c7" }, "fast")
    .animate({ opacity: "hide" }, "slow");

Solution

  • Inside the alertify callbacks this refer to window, to refers to the callee object you can use your element variable that stores the original element reference.

    Code:

            element.parents(".record").animate({
                backgroundColor: "#fbc7c7"
            }, "fast")
                .animate({
                opacity: "hide"
            }, "slow");
    

    Demo: http://jsfiddle.net/IrvinDominin/PUh6f/