wp_localize_script() explained

Read more