I have two chunks of HTML on my widget that I want to refresh with a timer, pulled from remote .js files that just do document.writes of HTML. Poor man's RSS sort of - but my needs go beyond RSS so that's not an option for me.
Anyway, I wrote this demo that basically works:
I am trying to do the same thing in my widget, but it never works. Let me explain.
In my loaded() function, called as onLoad in my BODY tag, I do this:
And that function I have defined as:
function loadXMLDoc(url)
{
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.>
req.open("GET", url, true);
req.send(null);
}
}
...and this function calls:
function processReqChange()
{
// only if req shows "loaded"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('news').innerHTML = "yo";
} else {
document.getElementById('news').innerHTML = "There was a problem retrieving the XML data:\n" + req.statusText;
}
}
}
And this is the block of code I am trying to replace (the element id = news)
<span class="newsText">
<br>
<div id="news">start</div>
</span>
...the problem is, req.readyState is always 0. The state indicates UNDEFINED. I do have:
<key>AllowNetworkAccess</key>
<true/>
In my plist. What could be the issue? I can hit the net fine from this machine. I have been stumped for days here. Any ideas? The issue is not really whether it's updating the 'news' element id because, as I said, when I output req.readyState in the top of processReqChange, it's always 0...
req is defined as a global var at the start of the .js file for my widget.
Thanks for any help!
bp
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Help/Unsubscribe/Update your Subscription:
Do not post admin requests to the list. They will be ignored.