In the following AJAX function, I'm trying to implement push array. There is problem with that array: I am not getting that array value in post in alert I am getting that value in array but when passing that value it's undefined.
<script type="text/javascript">
function getmember()
{
var myarray = new Array();
myarray.push($(".group_id").val());
alert(myarray);
$.ajax({
type: "GET",
url: "getmember.php",
data: myarray,
success: function(data) {
$(".the-return").html(
"Favorite beverage: " + data["favorite_beverage"] + "<br />Favorite restaurant: " + data["favorite_restaurant"] + "<br />Gender: " + data["gender"] + "<br />JSON: " + data["json"]
);
alert("bb");
}
});
return false;
}
</script>
<select name="group_id" class="group_id" onChange="getmember();" multiple>
<?php
$selectGroup = "SELECT group_id,group_name FROM `group`";
$groupRes = mysql_query($selectGroup);
while($row1 = mysql_fetch_array($groupRes))
{
echo '<td><option value="'.$row1['group_id'].'">'.$row1['group_name'].'</option></td>';
}
?>
</select>
group_idclass name in HTML you posted?I am not gettingwhere I'm not sure what you meant.