views:

245

answers:

2

Hello everyone,

I am working on website (built using PHP, Mysql, Jquery) which require that admin set a variable in configuration and according to that configuration variable Jquery autocomplete is enabled or disabled to all website. Is there any way to achieve that functionality.

Please help me, its very urgent........

A: 

Sure, just set a variable on the header, end of the body, or wherever you need to

echo '<script type="text/javascript">
    var autocomplete= '.$configuration['autocomplete'].';
</script>'; 

and work it from there.

Ben
Hi,Thanks for reply.I have tried your script, but still autocomplete box appears with values.I have write below code in index.php<script type="text/javascript" src="js/jquery.autocomplete.js?nocache=<?= getVersion () ?>"></script><script>var autocomplete= 'false';</script>I just want to set a variable globally in my website and all autocomplete box disable.Please help me .....
A: 

ok, you have some initialization function there, so check if autocomplete must be on/off in that function and not initialize that what you need, or do it. i dont see any problems to realize here..

function profiles_autocompletes_init(mode){

        ....check it here.... :)

    $("#"+mode+"ProfileSelecter").autocomplete("/autocomplete/profiles/", {
        ...
    }); 
}
Anton