Using Javascript/JQuery and getting undefined var when the page loads
<p>I have this Javascript/JQuery code:</p>

<pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt;

&lt;script type="text/javascript"&gt;

    name = $("#name").val();

    alert("Name: " + name);

&lt;/script&gt;
</code></pre>

<p>And this HTML:</p>

<pre><code>&lt;form name="report" action="send.php" method="post"&gt;

    &lt;input type="text" name="name" id="name" value="Senna" /&gt;
    &lt;input type="submit" value="Send" /&gt;

&lt;/form&gt;
</code></pre>

<p>When the page loads i get "Name: undefined" instead of "Name: Senna".</p>

<p>Can someone help me to get the expected result?</p>
