Get values in Wordpress from a settings page in javascript file

Viewed 21

im trying to implement api calls to another service in my plugin for Wordpress. Of course I can't write my password and username into the plugin file which will be public, so I implemented a settings page where the user can enter the values. In my button action I try to get the values again but it doesn't work:

var kasUser = wp.customize('userName').get()
var kasPas = wp.customize('password').get()

TypeError: wp.customize is not a function. (In 'wp.customize('userName')', 'wp.customize' is undefined)

How can I access the two values in my javascript file?

0 Answers
Related