php script calling parent javascript function
<p>I have this folder structure:</p>

<pre><code>index.php

js/scripts.js
</code></pre>

<p>In <code>index.php</code> I have a JavaScript function defined called <code>execute()</code>.</p>

<p>Now within <code>index.php</code> I have a form that when submitted will call <code>email.php</code> and at the end of the execution of the <code>email.php</code> I do this:</p>

<pre><code>echo '&lt;script type="text/javascript"&gt;parent.execute();&lt;/script&gt;';
</code></pre>

<p>This all works fine.</p>

<p>Now when I move <code>execute()</code> into <code>scripts.js</code> and I put this line of code in <code>index.php</code>:</p>

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

<p>then <code>email.php</code> is somehow unable to find <code>execute()</code> function. I know this because if I modify the execute function only the original version (the one that was in index.php) is ran.</p>

<p>I know this is weird, but I am new to this and I don't know of anyway I can debug this. Is there something obvious that I am missing?</p>
