Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

198
Vistas
Dynamically change text on HTML page from the С program

I have a web server (thttpd), and I want to periodically change the text on the HTML page depending on the data from my application C. I think to write a simple .txt file in the C application and periodically read it on a web server and change data on the HTML page. But I don't know how to do it. Maybe there are more correct and simple versions, how to do it?

ANSWER: I make this by using fetch(). This code read text from file dynamic_data.txt and change element with id="ispr_1" with this text every 3sec.

<script>

    const ispr = document.getElementById("ispr_1");

    var myFile = 'dynamic_data.txt';
    async function getUsers() {
        var response = await fetch(myFile, {cache: "reload"});
        if (response.ok) {
            var data = await response.text();
            ispr.textContent = data;
            return data;
        } else {
            alert('error', response.status);
        }
    }

    var intervalId = setInterval(getUsers, 3000);
</script>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Put your C file output somewhere in your server, and look at https://developer.mozilla.org/fr/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda