Author Topic: Ajax Today's High Temp Time not updating unless I refresh the browser  (Read 441 times)

0 Members and 1 Guest are viewing this topic.

Offline W3DRM

  • Forecaster
  • *****
  • Posts: 3360
    • Emmett Weather
The subject says it all. I had noticed it previously but didn't have the time to work on it. I've been through the code but don't see anything that could cause the issue. As far as I know, all other fields update when they should.


I've attached a screen capture that shows the screen before a refresh. After the refresh, the field updates to the correct time of the high.
Don - W3DRM - Emmett, Idaho --- Blitzortung ID: 808 --- FlightRadar24 ID: F-KBOI7
Davis Wireless VP2, WD 10.37s150,
StartWatch, VirtualVP, VPLive, Win10 Pro
--- Logitech HD Pro C920 webcam (off-line)
--- RIPE Atlas Probe - 32849

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
The Today entries are displayed in ajax-dashboard.php
Code: [Select]
                      <td style="text-align: right;"><strong><?php langtrans('High:'); ?></strong></td>
                      <td style="text-align: center;">
    <span class="ajax" id="ajaxtempmax">
                        <?php echo strip_units($maxtemp) . $uomTemp?>
                        </span><br />
                        <span class="ajax" id="ajaxtempmaxtime">
<?php echo fixup_time($maxtempt); ?></span>
  </td>
and
Code: [Select]
                      <td style="text-align: right;"><strong><?php langtrans('Low:'); ?></strong></td>
                      <td style="text-align: center;">
    <span class="ajax" id="ajaxtempmin">
                        <?php 
               echo strip_units($mintemp) . $uomTemp?>

                        </span><br />
                        <span class="ajax" id="ajaxtempmintime">
                        <?php echo fixup_time($mintempt); ?></span>
  </td>
so when first displayed, the values from testtags.php are shown
Code: [Select]
$maxtemp =  '77.7&deg;F'; // today's maximum temperature
$maxtempt =  '1:36 PM'; // time this occurred
$mintemp =  '45.9&deg;F'; // today's minimum temperature
$mintempt =  '5:36 AM'; // time this occurred

When ajaxWDwx.js starts execution, the values for ajax[min|max]temp[t] are updated by
Code: [Select]
var tempmax = convertTemp(clientraw[46]);
set_ajax_obs("ajaxtempmax",tempmax.toFixed(1) + uomTemp);

var tempmin = convertTemp(clientraw[47]);
set_ajax_obs("ajaxtempmin",tempmin.toFixed(1) + uomTemp);
but the max and min times are NOT updated by the ajaxWDwx.js script currently, so those times are only from testtags.php.

The variables now appear in clientraw.txt
Quote
174   Time of daily max temp   Time   1:36_PM
175   Time of daily min temp   Time   5:36_AM
but when the ajaxWDwx.js script was written in 2006, those fields weren't available in clientraw.txt so the markup was included in ajax-dashboard.php, just not any code to ajaxWDwx.js to update it.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline W3DRM

  • Forecaster
  • *****
  • Posts: 3360
    • Emmett Weather
Thanks Ken. I'm going to see if I can modify that portion of the code and get those two items working. Will post here, if I am successful.
Don - W3DRM - Emmett, Idaho --- Blitzortung ID: 808 --- FlightRadar24 ID: F-KBOI7
Davis Wireless VP2, WD 10.37s150,
StartWatch, VirtualVP, VPLive, Win10 Pro
--- Logitech HD Pro C920 webcam (off-line)
--- RIPE Atlas Probe - 32849