This part of my code isn't working, I already tried to do everything but it still doesn't working, what can I do to fix it?
$.ajax({
url: "https://corona-api.com/countries/BR",
type: "GET",
sucess: function(response){
document.getElementById("ifbr").innerHTML = response.latest_data.confirmed
},
error: function(){
document.getElementById("ifbr").innerHTML = "Erro na Consulta !"
}
})
I think you need to change sucess
into success
, and add data
like below:
$.ajax({ url: "https://corona-api.com/countries/BR", type: "GET", success: function(response){ document.getElementById("ifbr").innerHTML = response.data.latest_data.confirmed }, error: function(){ document.getElementById("ifbr").innerHTML = "Erro na Consulta !" } })
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <p>Confirmed: <span id="ifbr"></span></p>
You have misspelled success
here
sucess: function(response)
Instead it should be
success: function(response)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.