using Ajax: call to undefined function get_option

Basically, if you’re going to be making calls to WordPress functions, then you should be in the WordPress environment, which means that you should not be calling your own files to begin with, but should implement your AJAX call within a WordPress hook.

Read up on this: http://codex.wordpress.org/AJAX_in_Plugins

That article describes how to implement AJAX requests within WordPress plugins, but it works equally well in themes or in any other code that WP loads.

Essentially, you hook a function to wp_ajax_* or wp_ajax_nopriv_* and then make your request through the the admin-ajax.php file instead of directly to your own file.

Side note: Implementing a counter like you’re trying to do won’t work particularly well, because you have a race-condition there. More than one person can be visiting your site at the exact same time. Storing counter data in the DB like that isn’t going to scale to a very large site with lots of requests, although it will work fine for smaller sites.