/    Sign up×
Community /Pin to ProfileBookmark

Read Content of other HTML page to current HTML Page using Javascript

I think before I start off with the question I’ll explain the situation… It’ll make more sense that way (hopefully). ?

I’ve been asked to create a dashboard HTML page that will include charts generated in other HTML pages.

Each of the charts in those HTML pages (there are approximately 6 different pages) are only loaded when that particular HTML page is loaded, once that particular HTML page is closed, the chart no longer exists. I was thinking if whether it is possible to read the content in any one of those particular HTML pages and re-creating the chart and displaying it in the dashboard.htm page.

The first thing I was going to try and do was to grab a single line from a table in that HTML page and write it to the new dashboard htm page. But after much failed google search attempts I’ve resorted to actually seeking professional help in a forum. So my first question is, is it possible using JavaScript to read the content in any of those particular HTML pages in the dashboard html page?

Maybe something like this?

html page name: chocolate.htm

[code=html]
<html>
<head></head>
<body>
<p id=”test”>Some text here</p>
</body>
</html>
[/code]

[CODE]
var thePage = document.open(‘chocolate.htm’);

alert(thePage.getElementById(‘test’));

[/CODE]

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@Gray1989Jul 11.2012 — You may use AJAX to get what you need accomplished. http://www.w3schools.com/ajax/ajax_example.asp
Copy linkTweet thisAlerts:
@A5HauthorJul 11.2012 — hmm... I did think about that but I was trying to avoid going down that path.

I have actually found a new way of doing what it is I want to do through iframes. It's still not working as I want it to but I'm tweaking it and hopefully should get it to run.

The only problem I'm having now is referencing the charts that are generated in those other pages. I believe its called DOM HTML or something?
Copy linkTweet thisAlerts:
@Gray1989Jul 12.2012 — Please post the source code of what you have so far and I'll help you use AJAX in order to get this thing going ?
Copy linkTweet thisAlerts:
@A5HauthorJul 20.2012 — Hi Gray,

Sorry for the incredibly delayed response. Just thought I'd let you know that I've figured it out and I've got it all working.

I solved the problem by using iframes.

Thanks very much for your help though.

Ash.
×

Success!

Help @A5H spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...