XMLHttpRequest and Dashboard

HateEternal

Mac Metal Head
While working on my first widget (basically an UGLY rss reader for this site) I have run into a problem getting the rss to refresh. I am using setInterval to call the request method that I wrote which 1. updates the rss and 2. updates the Last update time.

Everything works fine in Safari, but in Dashboard the initial xml request is made and parsed and displayed, but it never updates. I thought it was a problem with setInterval but the time updates no problem.

Any ideas?

Code:
function init()
{
	makeRequest();
	interval = setInterval("makeRequest();", refreshSeconds * 1000);
}

function makeRequest()
{
	xmlRequest = null;
	xmlRequest = new XMLHttpRequest();
	xmlRequest.onreadystatechange = handleResponse;
	xmlRequest.open("GET", rssURL, true);
	xmlRequest.send(null);
}

function handleResponse()
{
	if(xmlRequest.readyState == 4)
	{
		parseXML(xmlRequest.responseXML);
		date = new Date();
		updateDate(date.getHours(), date.getMinutes());
	}
}
 
I thought the syntax was:
Code:
interval = window.setInterval("makeRequest();", refreshSeconds * 1000);
 
I've seen it done both ways, I looked at some other widget code and it was done the way I did it. I guess I could try it, the thing I don't understand is that it works perfect in safari. The way i have it works, makeRequest is called every 30 seconds because the time updates, I also set it to erase the rss for one 30 second period then display it the next. This works but it still gets the same information.
 
Is your *.plist file set up properly? I was having trouble with XMLHttpRequest until I compaired my plist with an Apple plist.
 
Back
Top