JQuery Marine Weather

Forums Requests JQuery Marine Weather

This topic contains 1 reply, has 2 voices, and was last updated by  Alexander Bautz 1 year, 4 months ago.

  • Author
  • #20709

    Nichols Family


    I have a autoupdating file located at;


    I want to pull the data from 42060 into a readable format so the result should be;

    weather for station “stn 42060” winds from “WDIR” at speed “WSPD” Wave height “WVHT”.

    do you have any ideas to get me started in the right path? I understand this is a text file but I have been unable to append and parse the data correctly. Thanks.


  • #20734

    Alexander Bautz

    This URL throw this response when I try to get the file with ajax:

    Failed to load https://www.ndbc.noaa.gov/data/latest_obs/latest_obs.txt: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘https://spjsblog.sharepoint.com’ is therefore not allowed access.

    Do you control this datasoruce? – if you bring up the dev console and type in this (you need jQuery so you should run the code in the console from a DFFS enabled form):

    jQuery.get("https://www.ndbc.noaa.gov/data/latest_obs/latest_obs.txt", function( data ) {

    Are you able to read it?

    If you do, I can help you parse it like this:

    var colDescr = [];
    jQuery.get("/path to the file/latest_obs.txt", function( data ) {
    			colDescr = line.split(/ +/);
    			colDescr[0] = "";
    			var cols = line.split(/ +/);
    			console.log("Weather from station \""+ cols[0] + colDescr[0]+"\" winds from \""+ cols[8] + colDescr[8]+"\" at speed \""+ cols[9] + colDescr[9] +"\" Wave height \"" +cols[11] + colDescr[11] + "\"");

    This snippet outputs to the developer console like the attached image show.


    • This reply was modified 1 year, 4 months ago by  Alexander Bautz. Reason: Added image

You must be logged in to reply to this topic.