Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery load() fails, but no JS errors
    primarykey
    data
    text
    <p>I am trying to create a small, simple JS framework for education purposes, but now I've got a problem I'm unable to solve.</p> <p><strong>Directory structure</strong></p> <pre><code>/ /framework jquery.js init.js /content home.html style.css index.html </code></pre> <p><strong>The problem</strong></p> <p>I'm obviously not pasting the jQuery file and stylesheet here, but here are index.html and init.js:</p> <p><em>index.html</em></p> <pre><code>&lt;!DOCTYPE html&gt; &lt;head&gt; &lt;script src="framework/jquery-1.5.min.js"&gt;&lt;/script&gt; &lt;script src="framework/init.js"&gt;&lt;/script&gt; &lt;title&gt;My website&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="content"&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><em>init.js</em></p> <pre><code>$(document).ready(function(){ if(!window.location.hash) { $("#content").load("../content/home.html", function() { alert("Load was performed."); }); } }); </code></pre> <p>The home.html file contains some sample text, nothing special. I expect jQuery to load the contents of home.html into the content div, but nothing happens when I load the page. The alert with the message "Load was performed" is fired, however.</p> <p>This task seems quite trivial to me so the mistake I made is probably quite silly, but any help is nevertheless very much appreciated.</p> <p>Thank you!</p> <p><strong>Update:</strong></p> <p>It works when I use this on my server, but in localhost it fails. I can't use the Firebug trick now, because it shows nothing when I use it locally.. Any ideas?</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