I am trying to get a parameter from the url with php and write it into a js variable to do some jquery stuff.
my url looks like that
www.example.com/?v=12345
My Code
vnew = "<?php echo $_GET["v"];?>";
if (vnew == null) {
myfunction();
}
else {
$(".myDiv").attr('src','newsrc');
$(".title").html("bla");
};
if the url is like www.example.com shouldn't the value be 'null', so that my function fires? However if i set it to '12345' the else condition does not fire either.
What is wrong here? Thank you!