title: Change php variable from jquery value using ajax (same page)
body: <p>What I'm trying to do it simply this:</p>
  
  <p>I've a php global variable <code>$currentID</code> and with a simple jquery script I check if there is a "id" (page) in the hash of url and if yes I wanted to give that value to <code>$currentID</code>.
  I've been reading a lot and I notice that I shall use Ajax but I'm not managing it.</p>
  
  <p>My code now is:  </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function(){
     if (parent.location.hash != '' ) {
       var theCurrentID = parent.location.hash.split('#')[1];
        $.ajax({
              url: 'my.php', //current page
              type: 'post',
              data: {theID: theCurrentID },
              datatype: 'json',
              success: function () {
  
              }
          });
     }
    // your code here
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Could you help me please? Thank you in advance.</p>