Calling A Function In External Javascript Asp.Net
<p>I am having trouble calling an external javascript function from my asp.net page</p>

<p>I have a file called user.js which I have this..</p>

<pre><code> UseThisNewThing:function () {
 alert("In Function External");
 }
</code></pre>

<p>My asp.net page references this file in the head tag..</p>

<pre><code>&lt;script src="Js/User.js" type="text/javascript"&gt;&lt;/script&gt;
</code></pre>

<p>Now I wanna call this function via jquery so in the code behind I have this</p>

<pre><code> if (page != null &amp;&amp; !string.IsNullOrWhiteSpace(scriptName) &amp;&amp; !string.IsNullOrWhiteSpace(scriptCommands))
            {
                Type parentType = page.GetType();

                // Check to see if the include script exists already.
                if (!page.ClientScript.IsStartupScriptRegistered(parentType, scriptName))
                {
                    page.ClientScript.RegisterStartupScript(parentType, scriptName,
                        "&lt;script type=\"text/javascript\"&gt;\njQuery(document).ready(function () {" + scriptCommands + "});&lt;/script&gt;"); ;
                }
            }
</code></pre>

<p>where parentType is this.Page, <code>scriptName="InitPage",</code> and </p>

<pre><code>scriptCommands=@"User.UseThisNewThing();"
</code></pre>

<p>I must be miossing something in this hook up beacuse I cannot get the alert to fire on page load</p>
