Manually Send Ajax request to a PHP file
For most functionality that you require with drupal, there is typically a module that already does what you are after or close to it.

I would recommend either:


using the module http://drupal.org/project/ajax_register
or looking at the code for the above module and make one that suits your exact needs


Hope this helps