Temperature Program Error- NO output coming!

I’ve attached my code here , can someone pls guide me as I’m not getting temperature in the output of this program .

@kumarsamarth2021 in the line 21, there is a syntax error because you are trying to parse the response.Text method of the object httpRequest whereas responseText is the correct method for the httpRequest object. So correct the spelling and the code will run fine :slight_smile:

Fixed it as you said , still the same :frowning_face: . what should I do , pls guide me

I tried the url which you have wrriten it says that the API key is not correct, please recheck the API key once and also make sure that you are using the correct API request syntax

okay lemme see once , the key could not have been wrong because I’ve copied the same from the site. lemme see once more

@kumarsamarth2021 I just checked the WeatherBit API, in there I saw that in the JSON file which we get as the response from the server, in there I can’t find a filed name as that of show_temp, there is a field named as app_temp, so I guess you are using a field which is not there in the JSON object.

I am providing the snip of the same:

Tried what you said, but no success :frowning_face:!! I just don’t know where am I going wrong

@kumarsamarth2021 I have figured it out. I have used your API key and in the response object I saw that the temperature is stored in the field named as temp, so use the following syntax:

document.getElementById(“output”).innerHTML = user_data.data.temp


@vishalvats2000 Did that too , still no success “crying noises”.

@vishalvats2000 Anything else you were able to find , I’m trying to find something at my end too!!
hope we can solve this soon buddy !!

Yes, @kumarsamarth2021 I have found the solution. Just drafting the solution :slight_smile:

wow @vishalvats2000, that is amazing , hope it works :slight_smile:

Line 20: this.readystate -> this.readyState

Try.

2 Likes

1 Like

Thanks @kumarsamarth2021 , if your query is solved please mark my post as solution so that the query is closed :slight_smile:

@vishalvats2000 Thank you buddy , this was very generous of you to give so much time to my work.Grateful!!:slight_smile:
Thanks to @akshayan.sinha too :slight_smile:

1 Like

Thanks @kumarsamarth2021 , if your query is solved please mark my post as solution so that the query is closed

Done buddy!!! @vishalvats2000 thanks for the help

1 Like

Literally I registered for the Weather Bit API and went through the JSON file :slight_smile: It was great to learn about this API through your query. Always welcome to help anyone to the best of my deeds :slight_smile:

1 Like

yeah man , sorry for so much trouble :slight_smile: but yeah it was a great experience learning !!

1 Like