<script>
var delay = (function(){
    var timer = 0;
    return function(callback, ms){
        clearTimeout (timer);
        timer = setTimeout(callback, ms);
    };
})();

$('.input-group-addon').click(function() {
    delay(function(){
        var tags = document.getElementById("tags").value;
        $.ajax({
            type: 'POST',
            url:  '../../pages/contacts/searching.php',
            data: { tags: tags },
            success: function(){
                document.location.href="../../composants/templates/layout-admin.php?id=<?php echo $id; ?>&pageVisitee=contacts&nomGroupe=Groupes&rech=true&recherche=" + tags;
            }
        })
    }, 0 );
});
</script>

