Ok, im back with new problems.
How do i add onclick calls function correctly?
When i click on it, it just refreshes.
When i tried onclick="’ . friend_request() .’" Clicking on it worked,but it sent request even if i just visited user’s page,but didnt clicked on it.In other words it called function without clicking on button.