javascript variable problem when sending data via jQuery $.post() function
<p>i have a problem when i want to send input data via jQuery $.post</p>

<p>i have this input:</p>

<pre><code>&lt;input id="mydata" value='&lt;?php echo $data; ?&gt;' &gt;
</code></pre>

<p>and i want to send it's data via jQuery $.post() function. </p>

<p>this $.post function runs but don't send anything:</p>

<pre><code>var the_data = $('#mydata').val();
//alert(the_data); has correct data!!
$.post("http://php/server", the_data , function(data){
    alert(data);
}, "html");
</code></pre>

<p>but this one sends data correctly:</p>

<pre><code>$.post("http://php/server", &lt;?php echo $data; ?&gt; , function(data){}, "html");
</code></pre>

<p>i should use input for saving data and method 2 isn't suitable for me.</p>
