Ciao,y
in pratica il file txt contiene un indirizzo ip cosi composto:
85.166.125.33
che deve essere letto da una funzione e deve caricarlo solo quando avvio la pagina nella variabile var url aggiungendo :85.
questa è la variabile come lavora oggi:
var url = '
http://192.168.1.178:8';
e questa è la richiesta in javascript:
function fazerRequisicao(){
$('#status').removeClass('label-success').addClass('label-warning');
$('#status').text("Richiesta lettura!!!");
$.ajax({
url: url,
data: { '': ''}, // usaremos em proximas versões
dataType: 'jsonp', // IMPORTANTE
crossDomain: true, // IMPORTANTE
jsonp: false,
jsonpCallback: 'dados', // IMPORTANTE
success: function(data,status,xhr) {
$('#status').removeClass('label-warning').addClass('label-success')
$('#status').text("Ok");
$('#sensor1').text(xxxz(data.sensor1));
$('#sensor2').text(statusRete(data.sensor2));
$('#sensor3').text(statusRete(data.sensor3));
$('#sensor4').text(statusRet(data.sensor4));
$('#sensor5').text(xxx(data.sensor5));
$('#sensor6').text(fines(data.sensor6));
$('#sensor7').text(fines3(data.sensor7));
$('#sensor8').text(fines4(data.sensor8));
$('#sensor9').text(fines1(data.sensor9));
$('#sensor10').text(fines2(data.sensor10));
$('#sensor11').text(fines5(data.sensor11));
$('#sensor12').text(energy(data.sensor12));
$('#sensor13').text(statusRetz(data.sensor13));
$('#sensor14').text(data.sensor14);
$('#sensor15').text(fines55(data.sensor15));
$('#sensor16').text(statusluci(data.sensor16));
$('#sensor17').text(statusluci(data.sensor17));
$('#sensor18').text(tapa(data.sensor18));
$('#sensor19').text(tara(data.sensor19));
$('#sensor20').text(tapb(data.sensor20));
$('#sensor21').text(tarb(data.sensor21));
$('#sensor22').text(tapc(data.sensor22));
$('#sensor23').text(tarc(data.sensor23));
$('#sensor24').text(tape(data.sensor24));
$('#sensor25').text(tare(data.sensor25));
$('#sensor26').text(tapd(data.sensor26));
$('#sensor27').text(tard(data.sensor27));
$('#sensor28').text(lucix(data.sensor28));
$('#sensor29').text(statusluci(data.sensor29));
$('#sensor30').text(statusext(data.sensor30));
$('#sensor31').text(data.Potenza_reale);
$('#sensor32').text(data.Temp_int);
$('#sensor33').text(data.Temp_int_sett);
$('#sensor34').text(data.Temp_ext);
$('#sensor35').text(data.Umid_ext);
$('#sensor36').text(data.Lux_ext);
$('#sensor37').text(data.Lux_ext_sett);
$('#sensor38').text(data.Tempo_luce_int);
$('#sensor39').text(data.Tempo_luce_ext);
data_val = (data.Potenza_reale);
gauge4.refresh(data_val);
i++;
console.log(data);