Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

XMLHTTPRequest Oddity



Hi,

I can not seem to figure out why my XMLHTTPRequest when the function is called again.

The function in question is as follows:
function retrieve() {
    xmlReq = new XMLHttpRequest();
    var URL = "http://www.url.com";;

    alert("XMLRequest");
    xmlReq.open("GET", URL, true);
    alert(xmlReq.readyState);
    xmlReq.onreadystatechange = function() {
        if (xmlReq.readyState == 4)
        {
            alert(xmlReq.readyState);
            alert(xmlReq.status);
            if(xmlReq.status != 200)
                failLoad(xmlReq.status);
            else {
                var Source = xmlReq.responseText;
                parse(Source);
            }
        }
    }
    xmlReq.send(null);
    return 0;
}

When the widget first loads, this function is called and passes just fine.

However if I press a refresh button on my widget (I have not got around to implementing a timer yet as I want the widget to work first) the request will begin, but the xmlReq.status is returning undefined.

Would anybody know why that would be?

Thanks in Advance

Micheal
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.