How to pass a variable from js to php?
I have that code
?>
From my understanding you have to pass it via a GET or a POST as PHP is server side and JS is client.
Ajax call.
Have a look how jquery works. It is very easy to make an Ajax call from javascript.to a PHP script passing what you want