How to enqueue some javascript source once per page
The best way to do this is to use wp_localize_script(), it serves exactly the purpose you are mentioning: passing strings to Javascript from PHP. You can do all sorts of interesting things with that: as a rule of thumb, use that when you want PHP to communicate with Javascript. In your case you want something … Read more