You can not load images with AJAX simply create a new image object and append, then the image can load asyncronously. Try this simple jQuery plugin:

$.fn.image = function(src, f){
    return this.each(function(){
        var i = new Image();
        i.src = "">        i.>        this.appendChild(i);
    });
}

Then call this plugin like:
$("#container").image(" http://jquery.com/images/hat2.gif",function(){
  alert("The image is loaded now");
});

2006/8/15, Braveheart <[EMAIL PROTECTED] >:

I stried to use ajax with jquery to load images. Basicly it works but I don't
get the image, instead I get some strange codes from the picture, I guess
because .jpg is a binary file.

Maybe this is a basic question, but still how can I load images with jquery
and is there any way to use that little animated .gif that shows that
somethink is loading with jquery?
--
View this message in context: http://www.nabble.com/how-to-load-images-with-jquery-ajax--tf2108823.html#a5812905
Sent from the JQuery forum at Nabble.com.


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to