$('#cont').click(function() {
$.ajax({
type: "GET",
url: "http://pp.vk.me/c608129/v608129926/13d7/M78M4KmekWI.jpg",
dataType: "image/gif",
success: function(img) {
i = new Image();
i.src = img;
$(this).appned(i);
},
error: function(error, txtStatus) {
console.log(txtStatus);
console.log('error');
}
});
});
$.ajax({
url:'https://pp.vk.me/c608129/v608129926/13d7/M78M4KmekWI.jpg',
type:"GET"
})
.done(function(data) {
console.log("загрузка")
var newInput = document.createElement("img");
newInput.type = "img";
newInput.id = "div";
newInput.src = test[0];
document.getElementById("cont").appendChild(newInput);
})
.error(function(){
console.log("ошибка")
})
.always(function(){
console.log("Всегда выполняется")
});
var img = new Image();
img.onload = function(){
document.getElementById("cont").appendChild(this);
}
img.src = '...';
$('#cont').click(function() {
var url = "http://pp.vk.me/c608129/v608129926/13d7/M78M4KmekWI.jpg",
that = $(this);
$.ajax({
type: "GET",
url: url,
dataType: "image/jpeg",
success: function(data) {
i = new Image();
i.src = url;
that.appned(i);
},
error: function(error, txtStatus) {
console.log(txtStatus);
console.log('error');
}
});
});
var xhr = new XMLHttpRequest();
xhr.responseType = 'blob';
xhr.onload = function() {
console.log(xhr.response);
var img = document.getElementById('img');
var url = window.URL || window.webkitURL;
img.src = url.createObjectURL(xhr.response);
}
xhr.open('GET', 'http://pp.vk.me/c608129/v608129926/13d7/M78M4KmekWI.jpg', true);
xhr.send();