GIF image when ajax loaded

Hi all,

I need help, i have successfully implemented ajax in my application but I am not able to set gif image when ajax get loaded. in ajax code how i can set this job.

earlier response will be appreciated.

thanx & regards

Zubair a khan

Subject: GIF image when ajax loaded

Zubair,

Your code would be,

function processReqChange()

{

   if ( req.readyState == 1 )

   {

                   document.getElementById("msg").innerHTML="<img

src=“+tmpurl+”.nsf/loading.gif?OpenImageResource />"

   }

if (req.readyState == 4)

{

   if (req.status == 200)

    {

         xmlStr=req.responseText

          if (xmlStr.replace(/^\s+|\s+$/g, '') == 1 ) {

            document.getElementById("msg").innerHTML="

Profile saved successfully !!";

         }



   }

  else

  {

           alert("There was a problem retrieving the XML data:\n"
  • req.statusText);

     }
    

    }

}

Rishi

Subject: RE: GIF image when ajax loaded

Bad idea – the “loading” gif will also take time to load. If the connection is slow, the user is stuck with a “frozen” page and doesn’t know whether that last click did anything at all. Good idea – load the image with the page but set its display propery to none (or visibility to hidden) and make it visible when necessary.

Subject: RE: GIF image when ajax loaded

Stan,

Great one, never thought :stuck_out_tongue:

Rishi

Subject: RE: GIF image when ajax loaded

thanks Stan for your help, please specify it how can do it

thanx & regards

zubair a khan