title: How to get element id into PHP variable
body: <p>Is it possible to get an element <code>id</code> into a <code>PHP</code> variable?</p>
  
  <p>Let's say I have a number of element with IDs:</p>
  
  <pre><code>&lt;span id="1" class="myElement"&gt;&lt;/span&gt;
  &lt;span id="2" class="myElement"&gt;&lt;/span&gt;
  </code></pre>
  
  <p>How do I get this into a <code>PHP</code> variable in order to submit a query. I suppose I would have to resubmit the page, which is OK. I would like to use POST. Can I do something like:</p>
  
  <pre><code>&lt;script language="JavaScript"&gt;
  $(document).ready(function(){
      $(".myElement").click(function() {
          $.post("'.$_SERVER['REQUEST_URI'].'", { id: $(this).attr("id") });
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>I need to pass <code>$(this).attr('id')</code> into <code>$newID</code> in order to run </p>
  
  <pre><code>SELECT * from t1 WHERE id = $newID
  </code></pre>
  
  <p><code>jQuery</code> is a very powerful tool and I would like to figure out a way to combine its power with server-side code.</p>
  
  <p>Thanks.</p>