Alex _TNT
Alex _TNT

Reputation: 319

Auto-reload and Search - php page

I'm trying add auto-reload a page where I have div in form of a table with only rows that include username.

Using https://github.com/stidges/jquery-searchable to search for username inside div here's the website http://tntdroid.xyz/global.php

If I auto-reload the container the search stops working. Does anyone know if there's a way to make this work. or an alternative

$(function worker(){
    $("#searchable-container").load('lib/global.php');
    setTimeout(worker, 10*1000);
});

$(function () {     
    $( '#searchable-container' ).searchable({
        searchField: '#container-search',
        selector: '.list-group-item',
        childSelector: '.col-md-4',
        show: function( elem ) {
            elem.slideDown(100);
        },
        hide: function( elem ) {
            elem.slideUp( 100 );
        }
    })
});

Upvotes: 0

Views: 36

Answers (1)

Mijago
Mijago

Reputation: 1639

After reloading the content, you need to re-create the searchable. Do this by re-calling

$( '#searchable-container' ).searchable({
    ...
});

This is needed because the complete element - with all its listeners - gets erased and overwritten.

Upvotes: 1

Related Questions