Mailing Lists: Apple Mailing Lists

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

Re: XMLHTTPRequest Oddity



Hi Michael,

I had the same problem and managed to remedy it by setting the If-Modified-Since header to force XMLHttpRequest to send the request to the remote server rather than fetching it from the cache (at least that's what I believe is happening).

Basically you want to add something like the following before the call to send.

xmlReq.setRequestHeader('If-Modified-Since', 'Wed, 15 Nov 1995 00:00:00 GMT');

See http://pansapien.com/?p=32 for full details.

Seems like this may be a bug with the XMLHttpRequest implementation in Safari 2.0, but I haven't checked into other implementations to know that this isn't just the way things work.

M.

On 14-May-05, at 3:22 PM, Micheal Jones wrote:

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">http://www.url.com";

    alert("XMLRequest");
    xmlReq.open("GET", URL, true);
    alert(xmlReq.readyState);
    xmlReq. {
        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:

This email sent to email@hidden


 _______________________________________________
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

References: 
 >XMLHTTPRequest Oddity (From: Micheal Jones <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.