I've searched through StackOverflow as well as multiple other sites but have not found a way to make this work as per the title. I have a base page that has a dropdown list automatically created as below:
<div class="tipfixtures">
<div class='styled-select blue semi-square'>
<select id="selFixRounds" onchange="getFixtureRound();">
<?php for ($x = 1; $x <= $compRounds; $x++) {
echo "<option value=".$x.">Round ".$x."</a>";
} ?>
</select>
</div>
</div>
<div id='rndList'>
<?php include ('fixtureTable.php'); ?>
</div>
The dropdown works fine and from this list I can select an entry, the following query assigns the value of the selected entry to fixtureRound:
function getFixtureRound() {
var fixRnd = document.getElementById("selFixRounds");
var fixtureRound = fixRnd.options[fixRnd.selectedIndex].value;
$.ajax({
url: 'fixtureTable.php',
type: 'GET',
data: ({fixtureRound}),
})
}
It is supposed to pass the fixtureRound value back to the query in fixtureTable.php as fixtureTable.php?fixtureRound=number via AJAX. I've checked the console headers and the url shows as it should above and the params showing fixtureRound: number. However I cannot get fixtureTable to recognise the GET variable, have the following code in the fixtureTable.php file:
$round = $_GET['fixtureRound'];
But am getting an undefined variable error plus I am unsure how to get the php to display. Any help greatly appreciated as I'm probably missing something really obvious here!
** EDIT ** Ok so I've dialled back the dumb a tad and have added isset for the $_GET which has gotten rid of the undefined error plus it now showing the correct listings in the console - Response Preview & Payload whenever different selections are made in the dropdown menu showing fixtureTable.php is being run with the correct $round variable, however it is not displaying the correct results in the div.