I'm using wp_enqueue_script to enqueue the public-facing JS of my WP plugin:

wp_enqueue_script($this->PluginName, plugin_dir_url(__FILE__) . 'js/public.js', array(), $this->version, false);

And in the other side I have:

var data = {
  name: ''

I would like, somehow, to set the name value to a value that I have access in the server side. Is this possible? Can someone point me to the documentation or an example of how to do that?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.