Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Javascript & AJAX Wind Speed The Same?

Discussion of Ken True's web site templates

Moderator: saratogaWX

Post Reply
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Javascript & AJAX Wind Speed The Same?

Post by William Grimsley »

Hi Ken,

Is it possible to make my Javascript wind speed "actual" like in my AJAX wind speed? e.g. Currently AJAX says: 13.0 mph Javascript says: 14.1 mph (avg)

Thanks

William
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Javascript & AJAX Wind Speed The Same?

Post by saratogaWX »

William Grimsley wrote:Hi Ken,

Is it possible to make my Javascript wind speed "actual" like in my AJAX wind speed? e.g. Currently AJAX says: 13.0 mph Javascript says: 14.1 mph (avg)

Thanks

William
Ummm.. I don't really understand your concern. It is JavaScript that does the AJAX (an acronym for Asynchronous JavaScript and XML)

The PHP page initially shows the data from the CUtags.php (uploaded by Cumulus at intervals, customarily every 5 minutes).
After the page is loaded, the ajaxCUwx.js JavaScript begins execution in the browser, and updates some of the HTML on the page with data from realtime.txt (which is uploaded by Cumulus more frequently). This HTML update continues until the allowed number of refresh cycles is reached, or when the page is reloaded in the browser and the whole process begins again.

So with that background, can you see that your question, as phrased above, is not really understandable.
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Javascript & AJAX Wind Speed The Same?

Post by William Grimsley »

Sorry, I didn't make myself clear enough, like you said.

What I'm saying is is that Javascript currently uses the average wind speed whereas AJAX currently uses the "actual" wind speed e.g. 13.0 mph, 14.0 mph etc, and I want them to use the same.

Hopefully, that makes more sense. :lol:
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Javascript & AJAX Wind Speed The Same?

Post by saratogaWX »

I can see you still aren't grasping the concept.

Read your sentence above replacing the word 'AJAX' with 'JavaScript' since AJAX=JavaScript in this context.

Using that, your sentence reads
What I'm saying is is that Javascript currently uses the average wind speed whereas JavaScript currently uses the "actual" wind speed e.g. 13.0 mph, 14.0 mph etc, and I want them to use the same.
Which makes no sense.
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Javascript & AJAX Wind Speed The Same?

Post by William Grimsley »

Ken,

Sorry, I am making no sense at all. :oops:

Here is what I mean using image form:

AJAX:
ajax.jpg
Javascript:
javascript.jpg
Now, I really hope this makes sense.

The boxes show what I mean. AJAX is currently using "reported" wind speeds and javascript is currently using "average" wind speeds.

Thanks

William
You do not have the required permissions to view the files attached to this post.
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Javascript & AJAX Wind Speed The Same?

Post by saratogaWX »

I see where you have the naming issue.

What you've termed 'JavaScript' is in fact, the PHP page (no JavaScript involved), and what you're calling 'AJAX' is a result of the JavaScript running and updating the page. So rightly, the pages are as attached.

The PHP page uses the Average wind speed since the page is only updated every 5 minutes, and the Average speed seems more representative of the conditions for the last few minutes up to the time of update of the PHP page.

The AJAX/JavaScript update uses the Recent wind speed since it is representative of 'now' and is updated much more frequently (like every 10 or 15 seconds).

Remember that not all viewers of your page will have JavaScript enabled in their browser, so they may only see the page produced by PHP and will never see the AJAX/JavaScript updates. If that is the case, the the PHP page provides a snapshot representative of the conditions seen at your station with a 5 minute update interval.

Next time, when you have a question about 'why' something is shown, try not to ascribe causality and do categorize the question saying whether the effect happens with JavaScript enabled or without JavaScript enabled -- you'll get better and faster answers without going through the cycle of clarifying questions.
You do not have the required permissions to view the files attached to this post.
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Javascript & AJAX Wind Speed The Same?

Post by William Grimsley »

Hi Ken,

Oh ok, so does that mean I can't have the "latest" wind speed on PHP as the same as AJAX?

William
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Javascript & AJAX Wind Speed The Same?

Post by saratogaWX »

Correct, because it doesn't make sense. I hoped you would read and understand what I'd explained and see that the request doesn't make sense.

PHP shows conditions at a infrequently (every 5 minutes) update so average windspeed makes sense there, rather than the possible outlier of the 'now' windspeed.

JavaScript/AJAX shows the 'now' windspeed in its update to reflect conditions 'now' and is timely at the update frequency of every 10 to 15 seconds.

They are not interchangable (if you want to make sense).
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Javascript & AJAX Wind Speed The Same?

Post by William Grimsley »

saratogaWX wrote:Correct, because it doesn't make sense. I hoped you would read and understand what I'd explained and see that the request doesn't make sense.

PHP shows conditions at a infrequently (every 5 minutes) update so average windspeed makes sense there, rather than the possible outlier of the 'now' windspeed.

JavaScript/AJAX shows the 'now' windspeed in its update to reflect conditions 'now' and is timely at the update frequency of every 10 to 15 seconds.

They are not interchangable (if you want to make sense).
Hi Ken,

Right, so having the "latest" wind speeds on Javascript (updating every 10 seconds) and having the "average" wind speeds on PHP (updating every 5 minutes) is perfectly ok then?

Thanks for you help and explanations,

William
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Javascript & AJAX Wind Speed The Same?

Post by William Grimsley »

So, having the "latest" wind speeds on Javascript (updating every 10 seconds) and having the "average" wind speeds on PHP (updating every 5 minutes) is perfectly ok then?
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Javascript & AJAX Wind Speed The Same?

Post by saratogaWX »

Yes it is ok (and by design), as it was explained previously.
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Javascript & AJAX Wind Speed The Same?

Post by William Grimsley »

Hi Ken,

Ok, that's fine! :D

Thanks very much for your help,

William
Post Reply