Ok I created a website for my Chapter at my school for our Org and I added the weather feature but it never updates itself to match the current weather how can i fix it this is what my code looks like

<td width="47%" align="left" valign="top" style="border-right-style:none; border-right-width:medium; border-top-style:none; border-top-width:medium" height="55">
        <!--webbot bot="PurpleText" preview="This space can be used to place some information that is useful to you (i.e.-Weather, News Headlines, etc.)" -->
        <p>Bloomsburg, PA - Sunny <br>
        <br>
        High: 73 , Low: 44 degrees</p>
        </td>

and here is the website address

Dani AI

Generated

Your page is showing hard-coded text, so it will never change by itself. As suggested, something needs to fetch live data (either client-side JavaScript or a server-side task). 's CMS idea is also valid because many CMS plugins handle the fetching for you. Two practical approaches that work on typical school hosting:

Client-side (fast to add)
Sign up for a free API key (for example OpenWeatherMap), add a small script that fetches the current conditions, updates a designated div, and re-runs on a timer. Example flow: fetch the JSON, read weather[0].description and main.temp, update #weather, and call the same function with setInterval every 10 minutes. A separate short setInterval can update a live clock with Date.prototype.toLocaleString so the page shows the current date/time.

Server-side (safer for keys and CORS)
If you cannot safely put the API key in browser JS or your API blocks client requests, create a small server script (PHP/Python) that runs via cron every 10–30 minutes, writes a JSON file, and serve that cached JSON to the page. This hides the key, avoids CORS issues, and limits API calls.

Notes and cautions
Do not poll too often (respect rate limits), use HTTPS for API calls, and provide a fallback text if the API fails. If you need a zero-code option, an embedded widget from a reputable provider is the simplest route but check update frequency and privacy. See the OpenWeatherMap API docs for request details and the MDN docs for fetch and Date.toLocaleString for examples:

OpenWeatherMap current weather API

Fetch API (MDN)

Date.prototype.toLocaleString (MDN)

Recommended Answers

All 2 Replies

You need a server-side langage (ruby, php, asp, aspx, .net, cgi) to update the weather.
Or you can have someone else host it and include a little javascript tag that will update a certain div with the weather when the page loads.
Your just typing as you would without change, you need something to update it.
Try this widget http://www.showmyweather.com/share/us/pennsylvania/bloomsburg/, it looks pretty clean. Just copy+paste the javscript/html it produces to your webpage for dynamic weather.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.