How to call a function in template.php through ajax from a page?
I would recommend using the Ajax Framework in Drupal 7 core: http://api.drupal.org/api/drupal/includes%21ajax.inc/group/ajax/7. 

You will need to create a callback through hook_menu which will return the html you want to load.

See the examples module for how to do this. The two functions show adding a link and using the 'use-ajax' class and creating a link using a render array:
http://drupalcode.org/project/examples.git/blob/refs/heads/7.x-1.x:/ajax_example/ajax_example_misc.inc

They both link to 'ajax_link_callback' which calls the other function ajax_link_response().

'ajax_link_callback' is defined in hook menu like so:

 180   // A menu callback is required when using ajax outside of the Form API.
 181   $items['ajax_link_callback'] = array(
 182     'page callback' =&gt; 'ajax_link_response',
 183     'access callback' =&gt; 'user_access',
 184     'access arguments' =&gt; array('access content'),
 185     'type' =&gt; MENU_CALLBACK,
 186     'file' =&gt; 'ajax_example_misc.inc',
 187   );