How can I take input on an HTML page this way?

Just Me

New member
Let's say we have a URL like this.
www.blahblahblah.com/watch?v=VIDEOID
How can I take the string that was appended after ?v= and send it to
a JavaScript variable? I am making a video site.
 
I'm not sure if JavaScript can do that or not. I think you need to use ajax. However, you can go roundabout a little with PHP.

<?php
echo '<script type="text/javascript">var videoID = ',$_GET['v'],'</script>';
?>
 
Back
Top