Jquery Ajax call not loading always
<p>I have this link that when clicked it pops up a div and collects data from another page through ajax call and loads the data in the div after success. But my problem is this, when I pop up the div and the data loads, then I close the div. When I click the link to pop up the div again and reload the data the data doesn't load, it doesn't sends the ajax call it just shows me the previous data that was loaded in the div before I close it. What I want to achieve is when ever the div is closed and the link is clicked again, the ajax call is sent to the php page and it reloads the new data this is the link that pops up the div <code>&lt;a href="javascript:;" onclick="showLikes('&lt;?php echo $id; ?&gt;')"&gt;Likes&lt;/a&gt;</code>. And here is the ajax call:</p>

<pre><code>function showLikes(x){
    document.getElementById('#likeDiv').style.display='block';
    $.ajax({
        type: "GET",
        url: "/get_likes.php?id="+x,
        beforeSend: function(){
            document.getElementById('#beforeSendImg').style.display='block';
        },
        success: function(data){
            document.getElementById('#beforeSendImg').style.display='none';
            likes = $(data).fadeIn(800);
            $("#likeDiv").html(likes);
        },
    });
}
</code></pre>

<p>Please does anyone knows how to do it better?</p>