1. Write the code to show the current weather based on geolocation. I am stuck and...

50.1K

Verified Solution

Question

Programming

1. Write the code to show the current weather based ongeolocation. I am stuck and cant figure out how to show theweather. My current code is below. Please try and useOpenweatherAPI.  

  

    Weather

    

      rel=\"stylesheet\"

      href=\"http://s3.amazonaws.com/codecademy-content/courses/ltp/css/bootstrap.css\"

    />

    

    

    

  

  

    

      Get my location.

      

      

      

The weather outsideis:

      

        Oops.. there isno temperature available for your location right now.

      

    

  

Answer & Explanation Solved by verified expert
4.3 Ratings (608 Votes)
Weather Get my location var x documentgetElementByIddemo function getLocation if navigatorgeolocation navigatorgeolocationgetCurrentPositionshowPosition else xinnerHTML Geolocation is not supported by this browser function showPositionposition xinnerHTML Latitude positioncoordslatitude Longitude positioncoordslongitude getWeatherDatapositioncoordslatitude positioncoordslongitude takes data    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students