ajax filter tag from controller call and fadeout with remove children tagcall


another long process to add a filtered element from the controller echo with ajax request, then fade out success response and have to remove the new inserted tag with attributes so you can cycle this function several times.

2014-12-07 13:33:29gstlouis

success: function(data){
            //$('.successSaved').css('background-color', 'green');

                'background-color': 'green',
                'color': "white",
                'padding' : '5px',
                'border-radius' : '10px'
            //$('.successSaved').css({ background-color:'green', color:'white' });


                $('.successSaved p').remove();
                $('.successSaved').css('background-color', 'white');
            }, 1500);
        error: function(data){
            alert('The time was not updated, please contact this application Administrator');

2014-12-07 13:33:49

The above works fine when you filter top level tags.  If you need to select children or descending tags you use find()



If you want to select the top-level elements = elements that are direct children of BODY - in this example: #wrap or #tooltip - then you have to use filter().

If you want to select other elements - in this example: #header, h1, #body, ... - then you have to use find().

I you don't know whether your element is a child of BODY or not, you could use this "hack":

$("<div>").html(data).find( selector );

By using this work-around, you always get the elements via find().

2015-02-25 22:21:44