I need to use an AJAX request to load a gif image from this source:
Everytime I try to do so and use the response on the image source as:
$('#cat-thumb-1').attr('src', 'data:image/gif;base64,' + data); It won't work!
When copying the response using firefox's devtools and using:
data:image/gif;base64,<PASTE_HERE> Everything works like a charm!
How can I figure out how to turn my response into an image correctly?
This is my AJAX request code:
function getCatImg() { return $.ajax({ type: 'GET', url: 'http://edgecats.net', datatype:"image/gif" }); } getCatImg().success(function(data) { $('#cat-thumb-1').attr('src', 'data:image/gif;base64,' + data); });
It won't work!isn't a proper problem description and is fairly meaningless. There is nodatatype: "image/gif"for ajax and what are you doing withreturn? Show the full usage of this code