View Full Version : jQuery Appending external html page to div with jQuery causes refresh

06-03-2009, 01:00 AM
Hi, im trying to append an external html page on the same domain into a div.
The html page has this javascript in it that prints out two names:

Namnsdag : <script language="Javascript" src="http://www.startsidan.org/namnsdag.php"></script>

But in firefox the pages refreshes and gets bugged, in IE only the text before javascript tags shows up in the div.

Im using this jQuery code

url: "test.html",
cache: false,
success: function(html){

So my question is, how can i load the external page into the div correct?

I have also set up a test page to show this error: http://cior.se/bugg/index.html


06-03-2009, 06:05 AM
If you're simply loading a JS file and executing it... try the following:


Additionally, script language="javascript" is deprecated and obsolete, use script type="text/javascript" instead.

As to why your function replaces the entire web-page.... it seems that the contents are:

function visanamndag() {
document.write ("Ingemar och Gudmar");
} visanamndag();

You do know document.write after a page has done loading does achieve that result, right?

06-03-2009, 04:32 PM
Thanks for the answer. Well, the page reloading bug, i should have knew about that, but i didint :p. Thanks for telling me.

I guess i can solve my problem by loading the page in a iframe instead. But then the height will be bugged.