|
#1
| ||||
| ||||
| Dashboard Widget + XML?
I want to write a dashboard widget that displays the last 5 posts of a web forum that I run. I've written a PHP script that runs on the server and queries the database for the information then spits out the result as XML. Now I'm lost. I have no idea how to get my widget to load & parse the XML file that the server is generating. I have written plenty of parsers in PHP & Actionscript but never in JavaScript. I don't even know where to begin... Unfortunately the Apple Developer page for dashboard doesn't have ANYTHING regarding XML parsing.
__________________ -Paul Wieland______________ http://www.sickdimension.com Dual G5 2.0Ghz / 2.5GB Ram / 620 GB HD / 23" CD |
|
#2
| |||
| |||
|
From what I understand the widget JavaScript is different than normal web JavaScript but in Web standard JavaScript you can do a obj.getElementsByTagName(sName) which will return an array of tag objects.
|
|
#3
| ||||
| ||||
|
thanks, that looks like it should do the trick. To get started though, how would you load the XML into an object?
__________________ -Paul Wieland______________ http://www.sickdimension.com Dual G5 2.0Ghz / 2.5GB Ram / 620 GB HD / 23" CD |
|
#4
| |||
| |||
|
You could try using XMLHttpRequest Code:
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "test.txt",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
alert(xmlhttp.responseText)
}
}
xmlhttp.send(null)
|
|
#5
| ||||
| ||||
|
Yes, excellent! Thank you very much.
__________________ -Paul Wieland______________ http://www.sickdimension.com Dual G5 2.0Ghz / 2.5GB Ram / 620 GB HD / 23" CD |
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Apple Dashboard Widget Contest | fryke | Mac OS X System & Mac Software | 0 | November 6th, 2004 05:51 AM |
| XML and Flash | twister | Design & Media | 7 | October 21st, 2003 06:41 PM |
| Thank God the Witch Is Dead | Veljo | Mac OS X System & Mac Software | 2 | June 27th, 2003 06:51 PM |