Reply To: JQuery Marine Weather

Forums Requests JQuery Marine Weather Reply To: JQuery Marine Weather

Alexander Bautz

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

Failed to load No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘’ 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("", 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 6 years, 2 months ago by Alexander Bautz. Reason: Added image