WordPress Core Function: wp_localize_script()
Localizes a script, but only if script has already been added. Can also be used to include arbitrary Javascript data in a page.
Use this WordPress core function to pass PHP variables or other data into enqueued JavaScript.