I've got a page set up where it loads each image on the page, one
after the other. As you can see here:

http://sandbox.exit42design.com/photography/folio_1.html

The problem with this is that if one of the images is broken, it'll
stop in it's tracks and not try to load the next.

Here's an example of how I'm loading the images

$(image[1]).load(function(){
        $("#image1").attr({src : image[1].src});
        image[2].src= "path/to/next/image.jpg";
});

$(image[2]).load(function(){
        $("#image2").attr({src : image[2].src});
        image[3].src= "path/to/next/image3.jpg";
});

So, basically when the first one is loaded, it inserts it onto the
page, and then sets up the next image path, and so on and so on. So I
need a way to detect if image 2 is going to load successfully, because
if it can't image 3 will never be allowed to load.

I tried using an ajax call but I'm not terribly familiar with how to
use it, for example, in an if statement. Can I get this ajax call to
just return a yes or no value of wether or not there was an error or
not?
$.ajax({url:imagesSrc[1], type:'HEAD', error:somefunction})

Thanks for any help. And any other comments/bug reports on the site
are welcome as well =)


Reply via email to