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!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?
— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.