I load some text and image into a div with an xmlhttprequest. Unfortunately the image onload event doesn’t works. The code is this:
<img src="pic.png" onload="alert('...')"/>
I can see the image after the request, but the onload event doesn’t fire. Why?
Thanks in advance
Can be down to caching. The onload event for images is a bit sketchy and doesn’t always fire for AJAX requests.
Try adding a query parameter to the request with the current date to stop any caching