I'm trying to SELECT * FROM table WHERE gender='whatever they clicked on';
WITHOUT refreshing the page. I am showing the gender table and then after the click a gender, I hide that table and then show the next, etc.
It's working fine, but whenever I start using the AJAX to grab the "POST" value of gender, it stops showing/hiding things..
BUT it IS grabbing the gender correctly. It just stops showing/hiding for some odd reason.
Here is my javascript code:
<script>
function chooseGender()
{
// we want to store the values from the form input box, then send via ajax below
var gender = document.getElementsByName("gender");
if (gender.checked)
{
var selectGender = gender.value;
}
$("#submitgender").hide();
$("#rest").show();
}
</script>
Then here is my Javascript code that won't work:
<script>
function chooseGender()
{
// we want to store the values from the form input box, then send via ajax below
var gender = document.getElementsByName("gender");
if (gender.checked)
{
var selectGender = gender.value;
}
$.ajax(
{
type: "POST",
url: "ajax.php",
data: "gender="+ Selectgender,
success: function()
{
$("#submitgender").hide();
$("#rest").show();
}
});
}
</script>
Then here is my HTML/PHP:
<form id="submitgender" method="post">
<table cellspacing="0" class="news" align="center" id="gender">
<tr>
<td colspan="2" style="border-bottom:1px solid #000;">
<center>Click on your gender:<br>
</td>
</tr>
<tr>
<td style="border-right:1px solid #000; border-bottom:1px solid #000;" width="300">
<center><input type="radio" name="gender" value="Male"><b>Male</b></center>
</td>
<td style="border-right:1px solid #000; border-bottom:1px solid #000;" width="300">
<center><input type="radio" name="gender" value="Female"><b>Female</b></center>
</td>
</tr>
<tr>
<td style="border-right:1px solid #000;" width="300" height="400">
<center><img src="http://www.elvonica.com/wardrobe/imgs/maleimage.png" /></center>
</td>
<td style="border-right:1px solid #000;" width="300" height="400">
<center><img src="http://www.elvonica.com/wardrobe/imgs/femaleimage.png" /></center>
</td>
</tr>
<tr>
<td colspan="2" style="border-top:1px solid #000;">
<button type="button" onclick="chooseGender()">Next</button>
</td>
</tr>
</table>
</form>
<table cellspacing="0" class="news" align="center" id="rest" style="display: none;">
CONTENT IS HERE, but the PHP works fine so I'm not going to bother showing it.
</table>