Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Writing JSON requests for data with an API, in Javascript*/
- <html>
- <meta charset="UTF-8">
- <head>
- <title>Sample page</title>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
- <script>
- var settings = {
- "url": "https://api.openweathermap.org/data/2.5/weather?zip=95050&units=imperial&appid=APIKEY",
- "method": "GET",
- "timeout": 0,
- };
- $.ajax(settings).done(function (response) {
- console.log(response);
- var content = response.wind.speed;
- $("#windSpeed").append(content);
- });
- </script>
- </head>
- <body>
- <h1>Sample Page</h1>
- wind speed: <span id="windSpeed"></span>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement