Accessing js data from php in PHP Server Side Scripting Language?

1 answer(s)
Answer # 1 #

Since PHP runs on the server before JavaScript runs in the browser, you can't access it directly. You'll have to send the data from the client back to a PHP script. The best way is using an AJAX request, like fetch(). Your PHP script can then easily access it using $_POST.

[3 Month]