Not showing temperature

Is there any wrong in my code?please help

Hi @chandachandramahesh,

Can you please share a screenshot of the logs that you are getting on console? Please inspect the webpage and click on the console.

If possible, you could also share the code here. We will look into it and will provide a solution for the error.

@chandachandramahesh I am looking into this and will get back to you shortly.

Hi @chandachandramahesh ,
Just remove this.readystate == 4 && .
Correct code:

  httpRequest.onreadystatechange = function() {
          if (this.status == 200) {
            result = JSON.parse(this.responseText);
            document.getElementById("output").innerHTML = result.data[0].temp;
            console.log(result.temp);
          }
        };

Do let me know if you need any other help.

1 Like