Untitled

mail@pastecode.io avatar
unknown
html
22 days ago
2.0 kB
1
Indexable
Never
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <style>
        body {
            margin: 0;
            padding: 0;
            font-family: 'Arial', sans-serif;
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100vh;
            background: linear-gradient(to right, #2193b0, #6dd5ed);
            color: #000;
        }

        .temperature-container {
            text-align: center;
        }

        .temperature {
            font-size: 4em;
            margin: 0;
        }
    </style>
</head>
<body>
    <div class="temperature-container">
        <div class="temperature" id="text-glavni"></div>
        <div class="temperature" id="text-sporedni"></div>
    </div>
</body>
<script>
    // A $( document ).ready() block.
$( document ).ready(function() {
    var settings = {
  "url": "https://6w9ogdp60d.execute-api.eu-north-1.amazonaws.com/prod/compare",
  "method": "GET",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/json",
    "Access-Control-Allow-Origin": '*'  
  },
};

$.ajax(settings).done(function (response) {
    console.log(response)
  $("#text-glavni").html('Current temperature in Lješevo is '+response.ljesevo_temp + '°C, and in Västerås is ' + response.vesti_temp + '°C');
  let hotterCity = response.ljesevo_temp > response.vesti_temp ? "Ljesevo" : "Vesti";
  let colderCity = response.ljesevo_temp < response.vesti_temp ? "Ljesevo" : "Vesti";
  $("#text-sporedni").html(colderCity + ' is chilling out, but ' + hotterCity + ' is cranking up the thermostat, proving that it\'s the hottest spot on the map!')
});
});

</script>
</html>
Leave a Comment