1

Ive already searched for infomation how I can do that but I cant fix this problem. I want to add a weather-widget to my webpage. It works using latitude and longitude. I want it should desplay the current weather from where the user is now.

    <span id ="long"></span>
<script type='text/javascript' id="weather-link" src='https://darksky.net/widget/default/></script>
    <script>const weatherLink = $("#weather-link");
    weatherLink.html("<span id=\"" + response.latitude + "," +response.longitude + "\">/uk12/de.js?width=100%&height=350&title=Basel&textColor=333333&bgColor=FFFFFF&transparency=false&skyColor=undefined&fontFamily=Default&customFont=&units=uk&htColor=333333&ltColor=333333&displaySum=yes&displayHeader=yes</span>");
    weatherLink.attr("src", weatherLink.attr("src") + response.city);</script>

The following code I use it to get users information. It works well

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>

          $("#long").html(response.latitude   + ", " + response.longitude );

    $("#response").html(JSON.stringify(response, null, 4));
  }, "jsonp");
</script>

I need to add to src a text that changes using that code above. THX

Opijkkk
  • 1
  • 6

0 Answers0