Hi Chris,

The EVDB.API JS library uses the append-script-to-header method to get around the same-domain restrictions on XMLHttpRequest and iframes.

Currently, one way to implement a request timeout would involve mirroring the API JS file [ http://api.eventful.com/js/api ] on your own server and modifying it.

After line 97:

    EVDB.API.elHead.appendChild(elScript);

Add:

    // set a timeout on the request (default: 10 seconds)
    window.setTimeout(function() {
      elScript.parentNode.removeChild(elScript);
      EVDB.API.requests[EVDB.API.idRequest] = null;
      EVDB.API.error("Request timed out.");
    }, 10000);

...and tweak as necessary. This is just off the cuff and hasn't been tested across browsers, so your mileage may vary. I'll look into implementing a more long-term solution in the next version of the EVDB.API JS library.

Thanks for your interest and good luck with your app!


--
Brad Fults
Eventful, Inc.
[EMAIL PROTECTED]


On Jun 13, 2007, at 1:46 PM, Chris wrote:

Hello,
I'm using the EVDB.API javascript library to make requests. This works fairly well but every once in a while a request "disappears." This is not a huge deal in most AJAX scenarios as there is a request timeout. However, I don't see a
way to set a request timeout using the EVDB.API javascript library.

I looked at the code and it appears the requests are made by adding script tags
to the header, a technique I have not seen before.

I believe my only option would be to simply implement a true async AJAX request
myself.

Any thoughts or suggestions are appreciated.

Thanks.


Reply via email to