Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

186
Vistas
Using ajax to display Content-Type image

I wrote a HTML page who calls thmbnail.ws to generate thumbnail for given URL (in this code it's a map from gmap), this is my code :

 $.ajax({
 	url: 'https://cors-anywhere.herokuapp.com/http://api.thumbnail.ws/api/API_KEY/thumbnail/get?url=http://maps.google.com/?q=36.82,10.17&width=800',
 	crossDomain: true,
 	headers: {'X-Requested-With': 'XMLHttpRequest'},
 	contentType: "image/jpeg",

 	success: function (data) {
 		console.log('Thumbnail Call OK');
 		console.log('Data Type : ' + typeof(data));
 		$('#map2').html('Image : <img src="data:image/jpeg;base64,' + data + '" />');
 	}
 });	

This is the execution result :

execution result

I thought the response is base64 encoded data, so i've tried to put data into an img tag (in div#map2) but no way : As you can see I have strange chars in the image area ! Debugger says result is image/jpeg, if I click on "Response" tab I have this : Reponse content

And when I clik "here" I have the good image : the final generated image

I can't figure out the right data type and how to display it in my page !

about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda