I have a Javascript file with the code I need to run my PHP project, but since it's a .js file I can't embed the PHP variables (such paths, config variables etc...) using the the <?php ... ?> way.
So I thought that one possible way would be using AJAX requests or a REST API.
Then two questions came in my mind:
- Could that lead to some performance issues? - I have to wait the server's response so I guess it's yes.
- Which are the possible alternatives?
Edit:
The config variables are stored in a PHP class for easy access from the PHP code. If you can tell me a better way I would really appreciate it.