AJAX - Run PHP function on button click
<p>I have a simple PHP based counter Wordpress function that updates the user meta every time the page is loaded.</p>

<p>What I would like to do is only run this function when a particular button is clicked.</p>

<p>My button markup</p>

<pre><code>&lt;a class="button" id="interaction-count" href="#"&gt;Interaction&lt;/a&gt;
</code></pre>

<p>My current PHP function (Which currently runs, and updates the user meta, on each page load)</p>

<pre><code>function setCvDownloads($postID) {
    $count_key = 'download_count';
    $count = get_user_meta($postID, $count_key, true);
    if($count==''){
        $count = 0;
        delete_user_meta($postID, $count_key);
        add_user_meta($postID, $count_key, '0');
    }else{
        $count++;
        update_user_meta($postID, $count_key, $count);
    }
}
</code></pre>

<p>Is is possible to run this when the <code>interaction-count</code> button is clicked instead? I assume some AJAX would be involved? If someone couple point me in the right direction that would be great</p>