I am using the AJAX GET method to return some names from a mysql database in the form of a button. This is done successfully and now when I click on one of these buttons I want it to call a javascript function which is working. When the button is clicked I also want to add a class to that specific button. Im doing it as follows -
$('.btn').click(function() {
$(this).addClass('btn-warning');
});
But it is not adding any class. Also this is the code I am echoing in the AJAX call -
echo "<button type='button' id=".$row['email']." class='btn names btn-link' onclick='personchange(\"".$row['email']."\",\"".$row['first_name']."\")'>".$row['first_name']."</button>";
Any help is greatly appreciated