I am working on a mini project on PHP. I'm using a div tag (with id="words") for displaying the words to be typed. For time being I've used javascript for initializing words with a particular string of text, using a variable str.
I've saved the code for initialization in script.js along with all the other javascript code needed for the site and have linked it to the main PHP page.
Now if I want to fetch the string of text from the database, I'll have to use PHP. So how do I use PHP to fetch the data and store it in the str variable for the initialization function to do it's work.
PS:
str variable is declared in the script.js file.