<button data-id="1" class="like">Like post 1</button>
<button data-id="2" class="like">Like post 2</button>
<button data-id="3" class="like">Like post 3</button>
var sendLikeRequest = function(id) {
// Send request to server
};
$(document).on('click', '.like', function(e) {
e.preventDefault();
sendLikeRequest($(this).data('id'));
})