I am new to php...I wanna to show a loading image when the page is loading something in php...any help would be appreciated

Recommended Answers

All 4 Replies

Member Avatar for diafol

You'll need to use js. Probably.

I agree with Ardav, PHP (server side scripting) will usually load and complete before an image could be seen on a page. js on the other hand is on the front side, and can start loading at the body tag as the page is loading.

<body onload="displayLoading()">

It has to do with the order in which a web page is called.
http request -> serverside script runs & completes -> sends info to client -> client side code runs and completes.

I agree with Ardav, PHP (server side scripting) will usually load and complete before an image could be seen on a page. js on the other hand is on the front side, and can start loading at the body tag as the page is loading.

<body onload="displayLoading()">

It has to do with the order in which a web page is called.
http request -> serverside script runs & completes -> sends info to client -> client side code runs and completes.

can u please elaborate it..What is the function used on onload

Member Avatar for diafol

Why don't you go over to the javascript forum? Or, do some reseaarch on js page load etc yourself?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.