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 8267787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:39:31+00:00 2026-06-08T05:39:31+00:00

I just tried to get this example code to run in my site. I

  • 0

I just tried to get this example code to run in my site. I put all the JS in its own function. When I don’t call the function the page loads fine, but of course it doesn’t show the pie chart. When I put the function to load the pie chart inside the $(function(){...}); nothing on the page loads. No JS errors or anything, just a blank page. I do not know how I can debug this? Does anyone have any ideas?

The problem is happening in this JS fiddle: http://jsfiddle.net/hC498/

But the problem doesn’t happen in this one, where you just copy and paste the JS into the HTML window with the rest of it: http://jsfiddle.net/hC498/1/

I can’t do this in my application because I want to wait until other page content loads before loading the pie chart. Why doesn’t it work when you move the JS to its own function?

  • 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-08T05:39:33+00:00Added an answer on June 8, 2026 at 5:39 am

    That is happening because you are calling the script that uses the jsapi before

    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    

    It works perfectly when performed in the following order.

     <script type="text/javascript" src="https://www.google.com/jsapi"></script>
        <script type="text/javascript" src="script.js"></script> <!-- the separate js file-->
    

    JSFiddle, inserted your JS to the beginning of the head element, even before your statement asking jsapi to load.

    See updated JSFiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just tried to run my test app and I got this error: 2012-06-16
I just started with the connectivity and tried this example. I have installed the
I try to implement basic data feed example and all I get is just:
$.get(http://localhost/code.php, function(data){ alert(data); }); code.php: <?php echo hello!; ?> I also tried other variants
I tried using this: mvn dependency:get -DrepoUrl=http://myserver/artifactory -Dartifact=com.mypackage:my-package-name:1.0.0 However it just downloaded the pom.xml
I just tried to use JCurses from within Groovy, but I always get the
I just tried the following code, but the result seems a little strange. It
I just tried the tooltip like this Easy image preview ... But i cant
When I try to run this page (video.php), I get the following error: Parse
I'm reading an article from this website , but when i run the code

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.