I'm wondering why this ajax call, passes the div id instead of the button one that I want to.
<?php
while($info = mysqli_fetch_array($sql))
{
echo "<tr>
<th>" .$info['name']. "</th>
<th>" .$info['pass']. "</th>
<th><a href=\"http://" .$info['link']. "\">" .$info['link']. "</a></th>
<th><div class=\"delbuttons\" id='5'> <button data-toggle=\"modal\" data-target=\"#myModal\" id='" .$info['id']. "'> Delete </button> </div> </th> </tr> ";
}
?>
</table>
<script>
$(document).ready(function(){
$('.delbuttons').click(function() {
$.ajax({
type: 'get',
url: 'ajax.php',
data: {
row: this.id
},
success: function(msg){
if (msg)
alert(msg);
location.reload();
}
});
});
});
</script>
I've set the button id to 5 just for debugging, and as I expected it returned "5" instead of the button's id.
I've tried both, get & post.
Thanks in advance!