Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8689767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:44:20+00:00 2026-06-12T23:44:20+00:00

I am trying to load an external html into the div using jQuery.load() method.

  • 0

I am trying to load an external html into the div using jQuery.load() method.
I call this method from document.ready().

html.1

    <script type='text/javascript' src='js/jquery-1.7.1.min.js'></script>
    <script type='text/javascript' src='js/script1.js'></script>
...

script1.js

$(document).ready(function() {
        $('div.dropzone').load('drawings.html');
});

The file is loaded, but is not shown till I press F5 (refresh), and sometimes even ctrl F5, some times (3-5). If I will not press F5 , the page will be never shown, however with some F5 presses the page is always shown.

The HTML that is loaded into div does lots of canvas drawing in its window.onload.

drawings.html

<script>
var init = function() {
   var container = document.getElementById('MyCanvas');
   var canvas = document.createElement('canvas');
   canvas.width = container.clientWidth;
   canvas.height = 1000;
   container.appendChild(canvas);
   return canvas;
}

window.onload = function()
{
   var canvas = init();
   var context = canvas.getContext('2d');
   context.beginPath();
   //... lots of drawings here
   context.closePath();
};

</script>
...
<div id='MyCanvas'>
</div>

When I remove this canvas thing and place some static HTML instead, it is shown without any problem.

Can somebody shed a light on what is going on here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T23:44:21+00:00Added an answer on June 12, 2026 at 11:44 pm

    Try changing window.onload to a named function, and call that function in the callback to load. Something like this:

    $(document).ready(function() {
       $('div.dropzone').load('drawings.html', function() {
          doMyNewNamedFunction();
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to load HTML/CSS from an external domain into a SWF using Actionscript
I'm trying to load a DIV element from an external page into my current
I'm trying to load some external content using jQuery load function to div on
I am trying to load an external jquery page into a div. I use
I ran into a bit of trouble while trying to load an external HTML
I'm trying to load and parse json data from an external source into a
I am trying to load an external page as a popup using jquery fadeIn()
I am trying to load some text from an external file, append this and
Trying to load content into a div, then on click load the previous content
trying to load in a bunch of images into a list from a directory...my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.