I want to implement AJAX to refresh the content automatically when there is new notification is incoming for the user.
Example for what I am trying to achieve:
user A
sent a friend request to user B
, so user B
gets a notification, but the notification is only showing after the page is refreshed. I want to refresh the notification automatically, whenever the database is updated/inserted a new value.
AJAX:
$('#ajax').click(function(){
$(document).ready(function(){
$.ajax({
type: 'POST',
url: '../main/count-fnd.php',
success: function(data){
$('#output').html(data);
}
});
});
});