-
-
Save jagroop/f498a5530b791f3194f4a184783bd861 to your computer and use it in GitHub Desktop.
sf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while($row = $result->fetch_assoc()) { | |
echo "<tr><td>" . $row["id"]. "</td> | |
<td>" . $row["name"]."</td> | |
<td>" . $row["email"]. "</td> | |
<td><a href='edit.php?id=". $row["id"] ."'> <button class='btn'>Edit</button></a> <br><br> | |
<a href='formd?id=".$row["id"]."'> <button id='delete-btn' data-user_id='".$row["id"]."''>Delete </button> </a> | |
</td> | |
</tr>"; | |
} | |
echo "</table>"; | |
} else { | |
echo "0 results"; | |
} | |
?> | |
<!--Dailogue box --> | |
<script type="text/javascript"> | |
$("#delete").click(function(){ | |
var id = $(this).data('user_id'); | |
var r = confirm('Are you sure to remove this record ?'); | |
if(r == true){ | |
$.ajax({ | |
url: '/formd.php', | |
type: 'GET', | |
data: {id: id}, | |
error: function() { | |
alert('Something is wrong');}, | |
success: function(data) { | |
$("#"+id).remove(); | |
alert("Record removed successfully"); } | |
}); | |
} | |
else{ | |
return false; | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment