how to get data from db using ajax
<script>
$(function(){
$(".like").click(function(){
var postid = $(this).attr("id");
$.ajax({
type:'POST',
url:'addlike.php',
data:'id='+postid,
success:function(data){
if(data=="you already liked this post"){
alert(data);
}
else{
$('a#'+postid).html(data);
}
}
});
});
});
</script>