$(document).on("click", "#addFavorite", function(event) {
    event.preventDefault();
    var postID = $(this).data("postid");
    var action = "favorites";
    var mission = "addFavorite";
 
    $.ajax({
        type: "POST",
        url: "posts.php",
        dataType: "json",
        data: {postID: postID, action: action, mission: mission},
        success: function(response) {
            if (response.success) {
                loadPosts();
            }
        }
    });
});
bu kod sayfayı yeniden yüklüyor
 if (response.success) {
                loadPosts();
            }