For a cleaner structure, I believe that the best way is to set all the data you get from PHP in one place, i.e. in the HTML that you use through PHP:
 <script> var MyNameSpace = { config: something: "<?php echo _VOTED_BEFORE ?>" } } </script> 
In the JavaScript file that you include later, you can access the value through MyNameSpace.config.something .
It also facilitates the reuse of the message.
 source share