You can make the value available to Javascript a number of ways. You can manually add a script declaration and echo the value.
Here is what I have been doing. This is not in a module, but just figure out how to access WebAssetManager and…
$wa = $this->document->getWebAssetManager();
$wa->addInlineScript('let myTextFile = ' . $myTextFile . ';')
And then myTextFile should be available to your JS code.
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
joomla-dev-gene...@googlegroups.com.
To view this discussion on the web, visit
https://groups.google.com/d/msgid/joomla-dev-general/ca0aac59-f28e-4984-881d-3f1ccdda3ac5n%40googlegroups.com.
Correction “…Whether you put that information in the PHP variable or in the JS code is up to you…”
To view this discussion on the web, visit https://groups.google.com/d/msgid/joomla-dev-general/SJ2PR22MB4167C3F73D060451B7FCCF63CB0D2%40SJ2PR22MB4167.namprd22.prod.outlook.com.