Why is my javascript function not found by the page it is embedded in?
<p>I have a page that has a simple javascript in the header portion of the page:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    function doLogout() {
        var conf = confirm("Really log out?");
        if (conf === true) {      //changed == to === for boolean comparison
            $.post("logout.aspx");
        }
    }
&lt;/script&gt;
</code></pre>

<p>It uses jQuery to do an AJAX post to my logout page.  The only issue right now is that when I click on the link (<code>&lt;a href="#" onclick="doLogout();"&gt;logout&lt;/a&gt;</code>) to fire this function, nothing happens.  I checked FireBug's console, and it told me that the function is not defined.  This has happened to me before, but I think I botched a bunch of code to fix it <em>sometimes</em>.</p>

<p>Does anyone know the proper way to fix this issue?</p>

<h1>Edit</h1>

<p>After doing a lot of googling and trying different things, I found this very <a href="http://forums.asp.net/p/1155910/1899157.aspx" rel="nofollow">concise and informative post</a>. Apparently, as the linked article states, the way the script is referenced in the web site is important as it won't run properly otherwise!  Hopefully this information will be useful for more people.</p>
