Author Topic: ajax-dashboard.php source doesn't match displayed values  (Read 642 times)

0 Members and 1 Guest are viewing this topic.

Offline W3DRM

  • Forecaster
  • *****
  • Posts: 3360
    • Emmett Weather
ajax-dashboard.php source doesn't match displayed values
« on: October 15, 2016, 02:56:04 PM »
I'm at a loss to explain what I am seeing on my website. The displayed website shows Today's rainfall at "0.12" and Yesterday's rainfall at "0.12". However, when I view the source code in my browser Today's rainfall shows "0.00" and Yesterday's rainfall shows "0.12". We actually had 0.12 inches of rain yesterday. Why then, does Today's rainfall show as also being 0.12 inches?

I've attached the "view source" results and the actual code for that section of the template.

View Source:

Code: [Select]

          <td valign="middle"><table width="166" border="0" cellpadding="2" cellspacing="0">
                  <tr>
                <td class="data1">Rain Today:</td>
                <td style="text-align: right;" class="data1">
              <span class="ajax" id="ajaxrain">
                    0.00 in                  </span>
            </td>
              </tr>
              <tr>
                <td class="data1">Rain Rate (/hr):</td>
                <td style="text-align: right;" class="data1">
              <span class="ajax" id="ajaxrainratehr">
                  0.001 in                  </span>
            </td>
              </tr>
                            <tr>
                <td class="data1" nowrap="nowrap">Rain Yesterday: </td>
                <td style="text-align: right;" class="data1">
              <span class="ajax" id="ajaxrainydy">
                  0.12 in                  </span>
            </td>
              </tr>
                                      <tr>
                <td class="data1">This Month:</td>
                <td style="text-align: right;" class="data1">
              <span class="ajax" id="ajaxrainmo">
                  0.21 in                  </span>
            </td>
              </tr>
              <tr>
                <td class="data1" nowrap="nowrap">Season Total:</td>
                <td style="text-align: right;" class="data1">
              <span class="ajax" id="ajaxrainyr">
                    0.21 in                  </span>
            </td>
              </tr>
                                       <tr>
                <td class="data1" colspan="2">
              1 day since last rain.                </td>
              </tr>
                              </table>
        </td>

Actual Code:

Code: [Select]
   <?php } else { // display Rain ?>
              <tr>
                <td class="data1"><?php langtrans('Rain Today'); ?>:</td>
                <td style="text-align: right;" class="data1">
              <span class="ajax" id="ajaxrain">
                    <?php echo strip_units($dayrn) . $uomRain?>
                  </span>
            </td>
              </tr>
              <tr>
                <td class="data1"><?php langtrans('Rain Rate'); ?> (<?php echo $uomPerHour?>):</td>
                <td style="text-align: right;" class="data1">
              <span class="ajax" id="ajaxrainratehr">
                  <?php echo strip_units($currentrainratehr) . $uomRain?>
                  </span>
            </td>
              </tr>
              <?php if(isset($yesterdayrain)) { ?>
              <tr>
                <td class="data1" nowrap="nowrap"><?php langtrans('Rain Yesterday'?>: </td>
                <td style="text-align: right;" class="data1">
              <span class="ajax" id="ajaxrainydy">
                  <?php echo strip_units($yesterdayrain) . $uomRain?>
                  </span>
            </td>
              </tr>
              <?php // end $yesterdayrain ?>
           <?php if (isset($vpstormrain)) { // Storm Rain is a Davis VP thing ?>
               <tr>
                <td class="data1" nowrap="nowrap"><?php langtrans('Storm Rain'); ?>: </td>
                <td style="text-align: right;" class="data1">
                  <?php echo strip_units($vpstormrain).$uomRain?>
            </td>
              </tr>
           <?php // end of DavisVP specific variable ?>
             <tr>
                <td class="data1"><?php langtrans('This Month'); ?>:</td>
                <td style="text-align: right;" class="data1">
              <span class="ajax" id="ajaxrainmo">
                  <?php echo strip_units($monthrn) . $uomRain?>
                  </span>
            </td>
              </tr>
              <tr>
                <td class="data1" nowrap="nowrap"><?php langtrans('Season Total'); ?>:</td>
                <td style="text-align: right;" class="data1">
              <span class="ajax" id="ajaxrainyr">
                    <?php echo strip_units($yearrn) . $uomRain?>
                  </span>
            </td>
              </tr>

« Last Edit: October 15, 2016, 03:09:20 PM by W3DRM »
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 wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: ajax-dashboard.php source doesn't match displayed values
« Reply #1 on: October 15, 2016, 03:13:32 PM »
Recent values are loaded from a realtime file by your Ajax script.
Check the realtime file for your weatherprogram. Maybe that file is not uploaded or the contents is old.

The HTML source reflects the values from your normal upload but that value is replaced by the Ajax script.

Wim

Offline W3DRM

  • Forecaster
  • *****
  • Posts: 3360
    • Emmett Weather
Re: ajax-dashboard.php source doesn't match displayed values
« Reply #2 on: October 15, 2016, 03:43:18 PM »
Recent values are loaded from a realtime file by your Ajax script.
Check the realtime file for your weatherprogram. Maybe that file is not uploaded or the contents is old.

The HTML source reflects the values from your normal upload but that value is replaced by the Ajax script.

Wim


Thanks Wim - that was the problem. For some reason I wasn't getting good uploads. I restarted everything and it now looks good. Thanks for the quick response. I had forgotten about the ajax script refresh that takes place. That's what happens when the code runs great for a long time and then I forget how things really work...  ](*,)
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

 

anything