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 t开发者_如何学编程here any way to achieve that functionality?
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.
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/", {
...
});
}
精彩评论