Link to home
Start Free TrialLog in
Avatar of nbcit
nbcit

asked on

On Image Ready

I have an ajax event that needs to fire once a image is completely loaded.
The image is a php file that sets a session variable and renders the image.

I need to wait until the session variable is set before firing the ajax event.

Is there a way to test that an image has completely loaded?
ASKER CERTIFIED SOLUTION
Avatar of Cem Türk
Cem Türk
Flag of Türkiye image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You could use the onload event in the image tag.  But, this method is not part of the HTML 4 specification.  It works with Opera, Firefox, IE, but technically not valid.  You might be able to get away with it anyway.

You could also put the image in an iFrame and use the onLoad event (see https://www.experts-exchange.com/questions/21219260/test-iframe-load-status.html)