I have some jquery to load an image in the background but I need to get some custom headers (generated with PHP) with further information about the image. Is there another way, I'm open to any ideas
var oldimg = $("#someimage");
var url = 'http://example.com/im[300x200].png';
var newimg = $("<img>").attr("src", url).load(function(){
//do something with headers before replacing the image
oldimage.replaceWith(newimg);
});
Edit: To clarify, I could read the image headers with this request but it would not be cached in the DOM. I need to load it in the DOM and read the headers.
var oldimg = $("#someimage");
var url = 'http://example.com/im[300x200].png';
$.ajax({
url: url,
success: function(data, textStatus, request){
console.log(request.getResponseHeader('some_header'));
}
});