I'm having difficulty loading images via Ajax on a site that I've been working on. I'm performing the ajax by using the Request.HTML object of the MooTools framework. Basically, I'm just passing some parameters to a php script which outputs some image tags and then I insert that HTML into a pre-defined content div. For some reason though, it seems that big images don't seem to load consistently when using this technique. Usually, they will just show up as broken images, but when I navigate to the url of the image that is 'broken', it displays just fine. Also, occasionally after navigating to the actual url of the image, my browser will cache the image and then it will display just fine when loading it through Ajax. Has anyone else encountered this problem?

Usually, they will just show up as broken images, but when I navigate to the url of the image that is 'broken', it displays just fine.

What do you mean by 'broken image'?

Just that a browser specific icon shows up that usually signifies that the link to the image is broken

Hi neclark,

loading images through AJAX is not advisable, since AJAX is build to handle file that is lower in size and a file within this format (.(x)html, .txt, .js etc.) as long as it is not a media file. So if you are loading a media file with a size of 258k or up, it requires a large amount of time before it can complete its dowload.
The request would just timedOut and break whatever on the line. However you can just apply a simple script that preload images inside your page w/o using AJAX.

This article has been dead for over six months. Start a new discussion instead.