Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!