hey after messing around the code I got it to work somewhat.
echo "<button onclick='american('lol')'>click</button>";
echo "<button onclick=american('lol')>click</button>";
and now it seems to change title to lol, but when I try to put a variable instead of the lol it does not change anything. Is something wrong with the variable? I did echo and it displays the content of the variable so I don't get why its not working.