Support

Account

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.