I'm totally new in WordPress as well as in PHP and making my first application with it.
Currently, I use 'HTML block Element' to add content with custom HTML and inline Javascript code on blank WordPress pages (using Elementor). I want to create a new config file(or add data on an existing one) on which I can define some variables which I then will be getting using Js and work accordingly.
I tried adding defines in the wp-config file and accessing them with Js but it didn't work.
wp-config
define('PERSONAL_KEY', 'VALUE');
In custom HTML code element of WP Page
<script>
var data = "<?php echo PERSONAL_KEY; ?>";
// Didn't worked
</script>
Is there any way to achieve getting variables inside inline JS code from an external config file?