In order to have access to WP functions in ajax you need to use it the way that WP considers “proper”. Your need to make all ajax requests through admin-ajax.php.
The best information on using ajax in WP can be found here: http://codex.wordpress.org/AJAX_in_Plugins
All the information about functions and add_actions and so forth can be used in your functions.php file as well as it can be used in a plugin.