stormsearchers Posted March 10, 2016 Share Posted March 10, 2016 (edited) var weather = new XmlhttpRequest(); weather.open("GET","http://api.wunderground.com/api/your key gose here/conditions/q/CA/San_Francisco.json", false); weather.send(null); var r = jsop.parse(weather.response); var dis ="Current location: "+ r.current_observation.display_location.full; +"<p>"; dis +="current temp:"+ r.current_observation.temperature_string+" <p>"; dis +="current wind speed: "+ r.current_observation.wind_string; document.getElementByID("weather").innerHTML =dis; My code is not working why is this also how can I call the weather icons, can anybody help me out many thanks Edited March 10, 2016 by stormsearchers Link to comment Share on other sites More sharing options...
justsomeguy Posted March 10, 2016 Share Posted March 10, 2016 First check your browser's console for error messages, that server might now allow Javascript to send requests to it. I think you'll probably see a couple error messages there. If that's a standard ajax request that you're sending then you also need to use a callback to handle the response from the server. Link to comment Share on other sites More sharing options...
davej Posted March 10, 2016 Share Posted March 10, 2016 What about these obvious errors? Javascript is case-sensitive. XmlhttpRequest vs XMLHttpRequest /your key gose here/ jsop.parse vs JSON.parse document.getElementByID vs document.getElementById Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now