Hello!

I have this function

<script type="text/javascript" >
var my = 5;
</script>

function somefunc($myvar) {
    return $myvar;
}

in my case I can not use javascript location.href and caught $ _GET ['my'].

I need accurate rendition of the JavaScript variable as an argument like this:

somefunc(my);

my is javascript var

Thank you!

    Javascript is client-side and PHP is server-side, so what you're trying to do is impossible without some type of request made from Javascript back to the server.

      Write a Reply...