Hmmm...well, it's documented out there so I won't try to repeat all the details (which I'd have to look up anyway). I think probably the best thing would be to find an example. One I ran across recently is the Cyb Chatbox mod (
https://vborg.vbsupport.ru/showthrea...ht=cyb+chatbox), it makes a background request to update the messages and uses a plugin on the misc_start hook. There's no magic on the server, it's just a normal http request. Sorry I'm not more help, but if you run in to problems you can post them here.
I just read your other thread - if you know the text you want to insert when the button is pressed, then it would probably be much easier to write it in to the page output as a javascript string and do something like Lynne suggested.