Here is my scenario, I have a Drop Down Select Option, by using this I get Category wise(Pending, Closed & All)Results using JQuery and AJAX. The data I get from AJAX(getcomplaints.php) contains another Dynamic Drop Down Select Option that works for on page operations. Now the issue is Jquery funtion to get the value of Select options is working on First List but When Data returns from AJAX page(getcomplaints.php) Containing another Drop Down options is not working. I don’t know why but Following Jquery function is Not working on AJAX returned data.
HTML
<select name="categories" id="getcomplaints" class="form-control">
<option value="all">All Categories</option>
<?php $c=$con->query("SELECT * FROM status");
while($cat=mysqli_fetch_array($c)){
?>
<option value="<?php echo $cat['status_id'];?>"><?php echo $cat['status_name'];?></option>
<?php } ?>
</select>
JS
$("#getcomplaints").change(function()
{
var id = $(this).find(":selected").val();
var toget = 'action='+ id;
$.ajax
({
url: 'getcomplaints.php',
data: toget,
cache: false,
success: function(r)
{
$("#display").html(r);
}
});
});
getcomplaints.php
$results='<tbody>
<tr>
<td><?php echo $d['c_id'];?></td>
<td><?php echo $d['s_name'];?></td>
<td><?php echo $d['c_desc'];?></td>
<td><?php echo $d['uname'];?></td>
<td><?php echo $d['status_name'];?></td>
<td><?php echo $d['c_time'];?></td>
<td>
<select id="more" name="option" class="form-control">
<option>MORE</option>
<option value="<?php echo $d['c_id']; ?>">Close</option>
<option value="<?php echo $d['c_id']; ?>">Reply</option>
</select>
</td>
</tr>
</tbody>';
I am simply echoing $result variable. it contains a Table with all Classes and IDs.
My Try
$("#more").change(function()
{
var id = $(this).find(":selected").val();
});