I'm using GET to retrieve a query string from my url e.g:
index.php?page=quiz
Then I want to run my function getPage which is JS using the value of page= (in this case it's quiz)
So I have an onload function which only runs if page has a value:
<body
    <?php
        if(!empty($_GET["page"])){
            //echo "onload='runPage(" . $_GET["page"] . ")'";
            echo "onload='runPage()'";
        }
    ?>
>
This basically works out as:
<body onload="runPage(quiz)">
I want to pass quiz in this case to the runPage function so that I can use it within it. For example:
function runPage(this){
  var page = this;
  console.log("Page = " + page);
}
But this just throws an error saying quiz is undefined... where is my logic wrong?
Edit: So I've updated my code and am now getting:
<body onload='runPage("quiz")'>
But now I want to take "quiz" and pass it to this function:
function runPage(){
// run stuff in here using the value of that variable e.g:
console.log("You've come through from the URL with quiz on the end");
}
 
     
     
    