Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to load a div with nested div's from a different file
    text
    copied!<p>I need to have my index.php load some content from home.php. Within index.php, there is a div class="content" which contains a dialog box (for a user login). Within home.php, there is also a div class="content" which contains some p's and tables (tables are created dynamically with php by querying a database). When the user clicks submit on index.php, I would like to replace the the contents of div class="content" with the same div (including all tables, etc.) from home.php. The problem is when I load the new div, I lose all of the nested divs (including the php created rows and columns), which I need. Any help would be tremendously appreciated. Thanks in advance.</p> <p>This is the html from index.php:</p> <pre><code>&lt;div class="content" id="first"&gt; &lt;div id="login"&gt; &lt;p&gt;Username: &lt;input type="text" id="loginName" Required&gt; &lt;/p&gt; &lt;p&gt;Password: &lt;input type="password" id="loginPass" Required&gt; &lt;/p&gt; &lt;span id="loginError"&gt;Please enter a username AND password&lt;/span&gt; &lt;/div&gt; &lt;/div&gt;&lt;!--content=first--&gt; </code></pre> <p>jquery from index.php:</p> <pre><code>$("#regButton").on('click',function(){ $(".content").load("home.php .content &gt;*"); }); </code></pre> <p>html from home.php:</p> <pre><code>&lt;div class="content" id="home"&gt; &lt;div id="left"&gt; &lt;div id="top"&gt; &lt;/div&gt; &lt;div id="bottom"&gt; &lt;h2&gt;Grades&lt;/h2&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="center"&gt; &lt;h2&gt;My Schedule&lt;/h2&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;Course ID&lt;/td&gt; &lt;td&gt;Course Name&lt;/td&gt; &lt;/tr&gt; &lt;?php echo "&lt;tr&gt;"; echo "&lt;td&gt;" . $row['courseDept']. $row['courseNumber']. " - ". $row['courseSection']."&lt;/td&gt;"; echo "&lt;td&gt;" . $row['courseName']."&lt;/td&gt;"; echo "&lt;/tr&gt;"; ?&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt;&lt;!--content#home--&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload