Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-03-2009, 12:00 AM   PM User | #1
d0ri0
New to the CF scene

 
Join Date: Aug 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
d0ri0 is an unknown quantity at this point
Appending external html page to div with jQuery causes refresh

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

Code:
$.ajax({
  url: "test.html",
  cache: false,
  success: function(html){
    $("#div1").append(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

Thanks.
d0ri0 is offline   Reply With Quote
Old 06-03-2009, 05:05 AM   PM User | #2
Eldarrion
Regular Coder

 
Join Date: Feb 2009
Location: Wheeling, IL
Posts: 358
Thanks: 5
Thanked 62 Times in 60 Posts
Eldarrion is on a distinguished road
If you're simply loading a JS file and executing it... try the following:

http://docs.jquery.com/Ajax/jQuery.getScript

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:

Code:
function visanamndag() {
document.write ("Ingemar och Gudmar"); 
} visanamndag();
You do know document.write after a page has done loading does achieve that result, right?
__________________
The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

How to ask smart questions?

Last edited by Eldarrion; 06-03-2009 at 05:11 AM..
Eldarrion is offline   Reply With Quote
Old 06-03-2009, 03:32 PM   PM User | #3
d0ri0
New to the CF scene

 
Join Date: Aug 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
d0ri0 is an unknown quantity at this point
Thanks for the answer. Well, the page reloading bug, i should have knew about that, but i didint . 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.
d0ri0 is offline   Reply With Quote
Reply

Bookmarks

Tags
load, refresh, reload

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:23 AM.


Advertisement
Log in to turn off these ads.