JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 8th, 2013, 03:51 PM
Sonfang Sonfang is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 13 Sonfang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 30 m
Reputation Power: 0
Javascript not loading XML?

Code:
<body onload="onLoad();" onresize="onResize();">
     <div id="my-timeline" style="height: 150px; border: 1px solid #aaa"></div>
		<noscript>
			This page uses Javascript to show you a Timeline. Please enable Javascript in your browser to see the full page. Thank you.
		</noscript>
        
        <script>
			var tl;
			 function onLoad() {
			   var eventSource = new Timeline.DefaultEventSource();
			   var bandInfos = [
				 Timeline.createBandInfo({
					 eventSource:    eventSource,
					 date:           "Jun 28 2006 00:00:00 GMT",
					 width:          "70%", 
					 intervalUnit:   Timeline.DateTime.MONTH, 
					 intervalPixels: 100
				 }),
				 Timeline.createBandInfo({
					 eventSource:    eventSource,
					 date:           "Jun 28 2006 00:00:00 GMT",
					 width:          "30%", 
					 intervalUnit:   Timeline.DateTime.YEAR, 
					 intervalPixels: 200
				 })
			   ];
			   bandInfos[1].syncWith = 0;
			   bandInfos[1].highlight = true;
			   
			   tl = Timeline.create(document.getElementById("my-timeline"), bandInfos);
			   Timeline.loadXML("example1.xml", function(xml, url) { eventSource.loadXML(xml, url); });
			 }
			
			 var resizeTimerID = null;
			 function onResize() {
				 if (resizeTimerID == null) {
					 resizeTimerID = window.setTimeout(function() {
						 resizeTimerID = null;
						 tl.layout();
					 }, 500);
				 }
			 }
		</script>
</body>


I'm working from here: http://simile-widgets.org/wiki/Timeline_GettingStarted


When I preview this in Chrome, it asks if I want to translate it because it's in Icelandic... I was like...okay...so I hit yes. That fails, however, and asks if I'd like to try again...

The info in the XML file isn't being loaded either. All I see is a timeline that I can at least scroll through. I'm attempting to test with the exact same file provided before I strike out on my own so I'm not sure what went wrong.

I saved my HTML file in the same folder as the example1.xml file to be sure that it was viewable. Do I need to upload this on a server to test with XML or did I blatantly screw up somewhere?

Reply With Quote
  #2  
Old January 8th, 2013, 04:07 PM
AndrewSW's Avatar
AndrewSW AndrewSW is offline
JavaScript is not spelt java
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2011
Location: Landan, England
Posts: 743 AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 23 h 14 m 42 sec
Reputation Power: 164
Have you correctly attached the Timelines API?

Code:
<script src="http://api.simile-widgets.org/timeline/2.3.1/timeline-api.js?bundle=true" type="text/javascript"></script>

Are there error messages in your browsers' console?

Have you tried it in different browsers?

Is your XML correctly formed?
__________________
"The mysql extension is deprecated as of PHP 5.5.0, and is not recommended for writing new code as it will be removed in the future. Instead, either the mysqli or PDO_MySQL extension should be used." the docs

Reply With Quote
  #3  
Old January 8th, 2013, 04:25 PM
Sonfang Sonfang is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 13 Sonfang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 30 m
Reputation Power: 0
Ahhh, okay, it's working in Safari...

Anything I can do to fix this?

Reply With Quote
  #4  
Old January 8th, 2013, 04:28 PM
AndrewSW's Avatar
AndrewSW AndrewSW is offline
JavaScript is not spelt java
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2011
Location: Landan, England
Posts: 743 AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 23 h 14 m 42 sec
Reputation Power: 164
Quote:
Originally Posted by Sonfang
Ahhh, okay, it's working in Safari...

Anything I can do to fix this?


Try creating another shortcut to Chrome and add the following to the command-line:

--allow-file-access-from-files

Reply With Quote
  #5  
Old January 8th, 2013, 05:14 PM
Sonfang Sonfang is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 13 Sonfang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 30 m
Reputation Power: 0
Should it be okay when the site goes live? I just want to be sure certain users won't be experiencing browser issues.

Reply With Quote
  #6  
Old January 8th, 2013, 06:21 PM
AndrewSW's Avatar
AndrewSW AndrewSW is offline
JavaScript is not spelt java
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2011
Location: Landan, England
Posts: 743 AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 23 h 14 m 42 sec
Reputation Power: 164
Quote:
Originally Posted by Sonfang
Should it be okay when the site goes live? I just want to be sure certain users won't be experiencing browser issues.


Should be. The setting I mentioned is only necessary when testing locally.

Reply With Quote
  #7  
Old January 9th, 2013, 09:03 AM
Sonfang Sonfang is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 13 Sonfang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 30 m
Reputation Power: 0
Now that I know it's working, I'm having an issue with Joomla in particular...

All we see when we upload this stuff is an empty box. We put the XML in the same location as the HTML, we took out the onload part because Joomla seems to swallow it up, and we looked up how to use this part:

Code:
<script src="http://api.simile-widgets.org/timeline/2.3.1/timeline-api.js?bundle=true" type="text/javascript"></script>


...in Joomla speak but it's still just a blank box. We used this format:

Code:
<source lang="php">
$doc =& JFactory::getDocument();
$doc->addScript( “http://www.example.com/js/myscript.js” );
</source>



So now we're looking at plugins instead but still...is this just not usable in Joomla or am I missing something obvious?

Reply With Quote
  #8  
Old January 9th, 2013, 09:23 AM
AndrewSW's Avatar
AndrewSW AndrewSW is offline
JavaScript is not spelt java
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2011
Location: Landan, England
Posts: 743 AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 23 h 14 m 42 sec
Reputation Power: 164
I don't touch Joomla. You might be better of posting on a Joomla forum.

Reply With Quote
  #9  
Old January 9th, 2013, 09:58 AM
Sonfang Sonfang is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 13 Sonfang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 30 m
Reputation Power: 0
Yeah, I wish I didn't touch Joomla either. =/

Thanks for your help.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Javascript not loading XML?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap