How to use JQuery and PHP?
<p>I am creating a PHP App and am using JQuery but have run into problems. For example, below is the code for a page i am writing, the alert() function calls when the pages loads but the second javascript Jquery code does not, I cannot see why one line works but the second does not?  </p>

<p><strong>help.php</strong></p>

<pre><code>&lt;?php
    echo "&lt;script&gt;";
        echo "alert(\"Loaded\");";   
        echo "$(\"#newDiv\").draggable().resizable();";
    echo "&lt;/script&gt;";
    echo "&lt;div id=\"newDiv\"&gt;";
    echo "&lt;/div&gt;";
?&gt;
</code></pre>

<p>The page calls the alert and creates the div but does not execute the jquery statement.</p>

<p>I think this may be due to have my page is structures and loaded. pages are loaded inside a div using Jquery and AJAX so the only page the user actually "loads" is an index.php page like so:  </p>

<p><strong>index.php</strong> </p>

<pre><code>&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;BluePrintr Web Application.&lt;/title&gt;
    &lt;link rel="stylesheet" type="text/css" href="public.css" /&gt;
    &lt;script type="text/javascript" language="javascript" src="jquery.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" language="javascript" src="myLibs.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php
    echo "&lt;div id=\"web_Page\"&gt;";
        //////////////////////////////////////////////////////
        echo "&lt;div id=\"web_Header\"&gt;";
            require("public/templates/header.php");
        echo "&lt;/div&gt;";
        //////////////////////////////////////////////////////
        echo "&lt;div id=\"web_Menu\" class=\"horizontalcssmenu\"&gt;";
            require("public/templates/menu.php");
        echo "&lt;/div&gt;";
        //////////////////////////////////////////////////////
        echo "&lt;div id=\"web_Content\"&gt;";
        echo "&lt;/div&gt;";
        //////////////////////////////////////////////////////
        echo "&lt;div id=\"web_Footer\"&gt;";
            require("public/templates/footer.php");
        echo "&lt;/div&gt;";
    echo "&lt;/div&gt;";
?&gt;
</code></pre>

<p>
</p>

<p>The menu loads and then any page selected from this menu is then loaded into the "#web_Content" div. So when the help.php page is selected from the menu, it injects the script into the div.</p>

<p>Can anyone see why the javascript code will not execute on help.php?</p>
