Ajax call module function I need to make asynchronous page requests on every page load using AJAX, the idea being that a function in my module is called even when pages are cached.

The only documentation I've been able to find (Drupal 7) is for form handling using AJAX and handling links. 

How do I call a module function from a custom AJAX request? Would I just implement hook_menu() and write a custom ajax request or is there a better way of doing this in Drupal 7?
I guess the answer depends on what that ajax call does, and if it is for a 'one site use' or for a contribution module. 

If it s for a contribution module hook_menu might be the only way to go.

Though if it s just for a 'one site use' i would just add a JS snippet in your page.tpl.php or even html.tpl.php that launches the Ajax query. This would work on every page even when if cached.

EDIT
Actually you could also use the page preprocess function and add a js file to all your pages.