SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Animated gif not shown during Ajax call

    I trying to achieve what seems to be a very common task: show an animated gif to indicate progress during an asynchrounous ajax call.

    pseudo code:

    var filter = document.createElement("img");
    filter.style.display = "none";
    filter.src = "animated.gif";
    hcell.appendChild(filter);
    ....
    filter.style.display = "block";
    myrequest = createRequest();
    myrequest.onreadystatechange = processMyRequest;
    myrequest.open("POST", WSAURL, true); // asynchronous!
    ....
    myrequest.send(nsoap);
    ....

    function processMyRequest {
    ....
    filter.style.display = "none";
    }

    However, during the request the animated gif is not displayed. It seems that my PC is too busy to show the result, since when I comment the last statement (filter.style.display = "none") the animated gif is display AFTER completing the request.

    The recipe above is common practice when I search the internet, and no one mentions the problem I have with it. Can anyone shed some light?

  2. #2
    SitePoint Zealot dustbuster's Avatar
    Join Date
    Jan 2003
    Location
    End-World
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you using prototype? If not, you should do so. This type of behavior is handled really easily.
    "If all else fails brute force is always an option."
    M.E.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •