Use wp_localize_script in order to dynamically set global javascript variables.