Home › Forums › General Issues › Using a the_field in Javascript › Reply To: Using a the_field in Javascript
Hi John ….
Thanks for your help.
It is set to ‘file url’. I suppose my question is more – Within the Javascript – should I be able to simply change the csv url from:
chart.dataSource.url = “../wp-content/uploads/2021/05/sample_data_serial.csv”;
To:
chart.dataSource.url = “<?php echo the_field(‘gas_data_file’, ‘option’); ?>”;
or if I have to something more fancy like I have seen in a few support posts already (sorry Java is not my forte…) like create a value from :
var datafile = <?php echo the_field(‘gas_data_file’, ‘option’); ?>;
and then add this in to the Java …. if so, it is here I am not sure how to write this last element.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.