So i have 3 pages. upload.php, main.php and script.js. Upload.php lists some database entries, and has a button behind each entry for more info on the entry. When you press the button it gives the ID value from the database with POST in the url and so it loads the info in main.php with the given id.
I have a javascript file: script.js which needs those db values that are echoed on main.php. I watched a tutorial on passing a variable from php to js using ajax. But the problem is that the values on main are only posted when you press the button in upload.php. Which means when i run the script it just fetches from main.php which has no values if the button is not pressed on upload.php.
How do i make the javascript get the values from main?
Im very new to js.