title: Add a call to PHP in a jQuery button with Ajax
body: <p>I tried to modify the behaviour of the <strong>Save button</strong> in my DokuWiki (<a href="https://forum.dokuwiki.org/d/18996-include-specific-php-only-after-saving-an-edit" rel="nofollow noreferrer">see my post on their forum without answer yet</a>).</p>
  <p>I want to call a specific <strong>file.php</strong> when the user hits the <strong>Save Button</strong>, i.e. every time there is an edit in the wiki. The PHP file recalculates all the connections in the Wiki and creates a new network diagram of the links in-between pages using Rscript.</p>
  <p>I think the best way to do that is to use <strong>Ajax</strong> when the button is clicked (<a href="https://stackoverflow.com/a/20738409/15473629">see this answer</a> about how to do that). This is <strong>the original jQuery code</strong> of the button in DokuWiki:</p>
  <pre><code>// reset change memory var on submit
  jQuery('#edbtn__save').on('click',
      function() {
          window.onbeforeunload = '';
          textChanged = false;
      }
  );
  </code></pre>
  <p>I would like to add something like:</p>
  <pre><code>jQuery('#edbtn__save').on('click',
      function() {
          window.onbeforeunload = '';
          textChanged = false;
          $.ajax({
            url: &quot;./data/forms/file.php&quot;,
            }).done(function( msg ) {
              alert( &quot;Data Saved: &quot; + msg );
            });
          }
  );
  </code></pre>
  <p>But this is not working yet (I tried different URLs too, but it is not clear what to use as I run DokuWiki on my localhost for the moment). I never studied jQuery nor Ajax, so this is new to me. I don't really understand how it works, but it might just need a simple fix.</p>
  <p>This is what the file.php looks like:</p>
  <pre><code>&lt;?php
  include(&quot;./data/forms/myFunctions.php&quot;);
  matrixer();
   ?&gt;
  </code></pre>
  <p>PS: the documentation I found <a href="https://api.jquery.com/on/" rel="nofollow noreferrer">about the function on()</a> and the <a href="https://github.com/splitbrain/dokuwiki" rel="nofollow noreferrer">DokuWiki source code</a>.</p>