JQuery - Update listing by ajax

1

I have an ajax which is called in 10 seconds by a setInterval, it gets a json and when I delete an item from json I need the item to add the ajax listing as well, the code to remove the item from the listing is $( "#item" + data.data[i].item ).remove(); , I just need an if for this, follows example:

success: function (data) {
    $.each(data.data, function(i, it) {
        if ( $( "#item-" + data.data[i].item).length ) {
             $( "#item-" + data.data[i].item+ " h2" ).html(data.data[i].item);
        }
    });
}

In the example it updates the item that comes from json ajax ...

    
asked by anonymous 17.08.2016 / 15:11

0 answers