easy peasy. once you got the val using JS. then all you gotta do is refresh the page like this....
JS code: summit like
document.write("<meta refresh 0 url:blah.php?x=".x."&y=.y.">";
url.com/blah.php?x=???&y=???
then u can use php to pick up those values.