Question: I want to use post to update a database and don't want people doing it manually, i.e., it should only be possible through AJAX in a client. Is there some well known cryptographic trick to use in this scenario?

Say I'm issuing a GET request to insert a new user into my database at `site.com/adduser/<userid>`. Someone could overpopulate my database by issuing fake requests.

Answer: 
It can be achieved.   

Whenever you render a page which is supposed to make such request. Generate a random token and store it in session (for authenticated user) or database (in case this request is publicly allowed).  

and instead of calling `site.com/adduser/<userid>` call `site.com/adduser/<userid>/<token>`   

whenever you receive such request if the token is valid or not (from session or database)   

In case token is correct, process the request and remove used token from session / db
It works like any other web page: login authentication, check the referrer.