Note that there are some explanatory texts on larger screens.

plurals
  1. POStuck on jQuery load method
    primarykey
    data
    text
    <p>This is a question that has been asked many times in its general form, but my problem is probably particular to my code. I'm pretty new to jQuery, so I'm sure I'm just doing something careless and am not realizing it. </p> <p>EDIT: I'm rendering this locally on my Dropbox folder while I build it, which might be making a difference.</p> <p>When you want to load a page in a div on the main page, you do something like this:</p> <pre><code>&lt;script&gt; $(document).ready(function(){ $("#paramframe").load("param.html"); }); &lt;/script&gt; </code></pre> <p>Where somewhere in the page is a <code>&lt;div id="paramframe"&gt;&lt;/div&gt;</code> and somewhere in the same directory is a page called <code>param.html</code>. Somehow, this doesn't work for me. </p> <p>This, however, does work for me:</p> <pre><code>&lt;script&gt; $(document).ready(function(){ $("#paramframe").html("&lt;p&gt;Replaced&lt;/p&gt;"); }); &lt;/script&gt; </code></pre> <p>So, right off the bat, I know it's not that I didn't load jQuery and not that I created a div wrong. But if I look at my page, which renders fine in a browser, I can't see anything wrong with it that would make jQuery ignore it.</p> <p>The contents of <code>param.html</code>:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" type="text/css" href="style.css"&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;This is where forms go.&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Can anyone see what I'm doing wrong? I've tried adding <code>event.preventDefault();</code>, but it didn't do anything. Thanks for looking!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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