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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:43:42+00:00 2026-06-11T05:43:42+00:00

I have a main page with a graph on, a dropdown box allows the

  • 0

I have a main page with a graph on, a dropdown box allows the user to select which graph they want to see.

When the dropdown gets changed I want AJAX to load the correct graph from my file, graphmaker.php. This file has all the graphs in appropriate DIVs, i.e graph1, graph2 etc.

These graphs are generated using Google Charts Visualisation.

However, when I do this AJAX just loads an empty box and from what I have researched this is because the script on the page doesn’t get executed.

In essence, I want Ajax to:

  • get graphmaker.php
  • render the page
  • then pull out the correct graph

My code:

function switchgraph(graph) {
var switchto = $("#graph"+graph+"_dd").val();
$('#graph'+graph).load('graphmaker.php #'+switchto);
}

Any suggestions?

Dave

  • 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-11T05:43:44+00:00Added an answer on June 11, 2026 at 5:43 am

    Instead of using a selector with load, which removes the scripts, select the relevant graph once the AJAX call has finished:

    function switchgraph(graph) {
        var switchto = $("#graph"+graph+"_dd").val();
        $('#graph'+graph).load('graphmaker.php', function onComplete() {
           function doMoveGraph() {
               $('#graph' + graph).empty().append(toBeUsed);
           }
           function checkMoveGraph() {
                if (!toBeUsed.is(":empty")) {
                    doMoveGraph();
                } else {
                    setTimeout(checkMoveGraph, 100);
                }
           }
           var toBeUsed = $(this).find('#'+switchto);
           setTimeout(checkMoveGraph, 100);
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a main page which gets the information from a local xml file
I have a page (main.php) which loads content from an external PHP file (rpc.php).
On my main page I have this jquery code which does an ajax call
I have an PHP/HTML main page, in which I include different other PHP files
I have a main page which uses a ViewModel I have created: public class
I have a main page that starts a PHP session, which creates session ID
I have a main page which looks like: <%@ Page Title= Language=C# MasterPageFile=~/Views/Shared/Site.Master Inherits=System.Web.Mvc.ViewPage
Please help guys, the issue is - i have main page and want to
I have the main page (called 'main.html'), with a link on it, with which
I have a main page (main.html) which opens an iframe page (iframe.html).. The iframe

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.