 <p>So, after some chat, here is my solution, hope this help: I made 2 <code>.html</code> files, <code>a.html</code> and <code>b.html</code>.</p> <p>Content of <code>a.html</code>:</p> <pre><code>&lt;div&gt;&lt;/div&gt; &lt;script&gt; $.getScript("main.js", function() { $("div").load("b.html #items"); }); &lt;/script&gt; </code></pre> <p>And <code>b.html</code>:</p> <pre><code>&lt;body&gt; &lt;script src="main.js"&gt;&lt;/script&gt; &lt;/body&gt; </code></pre> <p>Also content of <code>main.js</code> file:</p> <pre><code>$('&lt;div&gt;&lt;/div&gt;', { text: 'I am alive !!!', id: '#items' }).appendTo('body'); </code></pre> <p>and when I open the <code>a.html</code>, I can see <code>I am alive !!!</code>.</p> <p><strong>Edit</strong>:</p> <p>Please note, I didn't add link of <code>main.js</code> to <code>a.html</code>.</p> <p><strong>UPDATE</strong>, same result with this code:</p> <pre><code>$.getScript("main.js").done(function() { load(); }).fail(function(jqxhr, settings, exception) { alert("Triggered ajaxError handler."); }); function load() { $("#Result").load("b.html #items", function(response, status, xhr) { if (status == "error") { var msg = "error: "; $("#error").html(msg + xhr.status + " " + xhr.statusText); } }); }; </code></pre>