I manage do change the text in my button using Javascript.
Using this code
$("#unfriend").click(function(){
$.post("/unfriend/<?= $friend_but->id ?>",
function(data,status){
//alert(data);
if (data == 'ok') {
alert(data);
$('#unfriend').html('Add Friend');
};
});
});
But I have a problem, how can change the id #unfriend into #addfriend?
I added $('#unfriend').setAttribute('id','addfriend'); but it's not working. And When I also added that code, the text in my button is not changing.