title: Calling a PHP function on button click?
body: <p>I have a html button which has an onclick method. The function which is ran onclick has a php function in but is called in JS, like below.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function Test() {
        &lt;?php add_post_meta($post-&gt;ID, '_my_meta_key', true); ?&gt; 
      }
  &lt;/script&gt;
  &lt;button onclick="Test()"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>The page this code is on is a wordpress admin page. When the page loads, the php function is ran anyway instead of waiting for the button click event. Is there a way to stop this from happening and only fire once the button is clicked.</p>