0

I am trying to get an image to appear in my application however the api that I am trying to get the image from has the files as pngs when called so I was trying to use base64 to get the images to work to no avail. Here's the code:

$("button").on("click",function(){
var num= $("#number").val()
var purl="http://pokeapi.co/api/v2/pokemon/"+num;
var im="http://pokeapi.co/media/sprites/pokemon/female/12.png"
var unicode=btoa(im);
console.log("pizza")
$(document).ready(function(){
$.ajax({
  url:purl,
  success:function(response){
    console.log("hello")
    $("h4").append(response.name)
    console.log(response.name)
    $("h5").text(function(t){
    $.ajax({
      url:unicode,
      success:function(c){
      console.log("blue bessr")
      console.log(c)
      $("#imag").http("<img src="+ c+">")
    },
      error:function(error){
        console.log(error)
      }
    })
  })
  },
  error:function(e){
    console.log(e)
  }
})
})
})
sacora
  • 265
  • 1
  • 3
  • 8

0 Answers0