How can Javascript securely access user info?
<p>When a user clicks on my green button, I need Javascript to detect this and pass the $UserID and $ActivityID to the server to be stored in the database.</p>

<p>But what's the best way for JS to securely get this info and send it to the server?
I've been hiding variables in the HTML:</p>

<p>HTML:</p>

<pre><code> &lt;div class="green-button"&gt;Add it&lt;/div&gt;
 &lt;input type="hidden" class="u" value = " &lt;?php $UserID ?&gt;  "/&gt; 
 &lt;input type="hidden" class="a" value = " &lt;?php $ActivityID ?&gt;  "/&gt; 
</code></pre>

<p>jQuery:</p>

<pre><code>jQuery('.green-button').click(function(event){
var $UserID = jQuery(this).siblings('input').hasClass('u').attr('value');
var $ActivityID = jQuery(this).siblings('input').hasClass('a').attr('value');
// rest of the code...
</code></pre>

<p>However, this doesn't seem secure. 
What if someone uses Firebug to change the HTML and then clicks on the button?
Won't garbage be written into the dbase?</p>

<p>Thanks for the tips.</p>
