开发者

jQuery AJAX with multiple URLs

开发者 https://www.devze.com 2023-01-01 12:22 出处:网络
I\'m using jQuery to load the images before displaying开发者_开发知识库 them. The problem is that I don\'t know how many images are going to be loaded. The page loads the image paths from a XML file.

I'm using jQuery to load the images before displaying开发者_开发知识库 them. The problem is that I don't know how many images are going to be loaded. The page loads the image paths from a XML file. I'm using this:

$.ajax({
    url: 'images/BYLINE/1.png',
    dataType: "image/png",
    success: function(data) {
        alert('psil');
    },
    error: function(XMLHttpRequest, textStatus, errorThrown) {
        alert(textStatus);
    }
});


is there any good reason for using jquery for this? you could simply use the good old technique for preloading images with javascript like this:

new Image().src = "images/BYLINE/1.png";
0

精彩评论

暂无评论...
验证码 换一张
取 消