5
I’m having some problems updating a div without updating the full page.
Follows the code:
<div class="main" align="justify">
<div id="mensagens">
<?php echo file_get_contents('arquivo.txt'); ?>
</div>
...
I’ve thought about creating a "frame" - I’m not sure if that would be the name - and using "meta refresh" to update inside it.
My question is: How to update this Div using PHP or Javascript? And, if possible, you could update this Div whenever there is a change in the ".txt file"?
Updating
The ".txt file" is updated normally:
$texto = htmlspecialchars($_POST['text']);
$string = $texto . "\n";
$fp = fopen('arquivo.txt', 'a');
$fw = fwrite($fp, $string);
fclose($fp);
You can use
.ajax
or.get
jQuery. See here a question related togetJSON
.– gustavox
How/why this ".txt file" is changed?
– Sergio
The.txt file would be like a "database". Users send the content there instead of using a normal database. There it is all configured and organized according to the output I want.
– dialup
This is some test system ?
– Edilson
Yes, it would just be an "experiment".
– dialup
I also recommend using Ajax
– DiChrist