Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var lampo = "";
- $(function() {
- $("#search").click(function() {
- var paikkakunta = $("#paikkakunta").val();
- $.ajax({
- url: "openweathermap.php",
- method: "GET",
- data: {
- "paikkakunta": paikkakunta
- },
- success: function(result) {
- tulosta(result);
- },
- error: function(xhr) {
- alert("Virhe: " + xhr.status + " " + xhr.statusText);
- }
- });
- });
- });
- function tulosta(result) {
- console.log(result)
- lampo = Number(result.main.temp) - Number(273.15);
- $("#tulostus").html(lampo + " C");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement