Skip to content

Instantly share code, notes, and snippets.

@kodamirmo
Created July 5, 2017 21:43
Show Gist options
  • Save kodamirmo/f717628672a204967099dc8318390428 to your computer and use it in GitHub Desktop.
Save kodamirmo/f717628672a204967099dc8318390428 to your computer and use it in GitHub Desktop.
var xhr = $.ajax({
url: "http://52.26.247.55:8080/EWS/web/kit",
method: "GET",
}).done(function(respuesta) {
var experiencia = respuesta.data[0];
console.log( "Experiencia: ", experiencia );
var nombre = experiencia.attributes.kit;
var descripcion = experiencia.attributes.descripcion;
var precio = '$' + experiencia.attributes.precio;
var imagen = experiencia.attributes.imagen;
if (imagen.indexOf('http') == -1) {
imagen = 'http://' + imagen;
}
$('#nombre').text(nombre);
$('#descripcion').text(descripcion);
$('#precio').text(precio);
$('#imagen').attr('src', imagen);
}).fail(function(jqXHR, textStatus) {
cosole.log( "error: ", textStatus );
}).always(function() {
console.log( "complete" );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment