You do not need ajax for this. here is a method using php.
Code:
<?php
$do = 'yes';
$ann = '';
$file = @fopen("announcement.txt","r") or exit("announcement file does not exist!");
while(!feof($file))
{
$ann .= fgets($file);
if($ann != '') $ann = $ann.'<br />';
}
if($ann == '')
$do = 'no';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>New document</title>
<style type="text/css">
#announcement{
width: 300px;
height: 100px;
border: black solid 1px;
}
</style>
</head>
<body>
<?php
$mystring = <<<EOT
<div id="announcement">
$ann
</div>
EOT;
if($do == 'yes') echo $mystring;
?>
Give me an announcement
</body>
</html>
The text file "announcement.txt" is your announcement and looks like this:
Code:
Now is the time
for all good men
to come to the aid
of their country
Test this with the given text file. Then empty the text file of everything and lastly test it by deleting the file altogether.
If you like this approach and want further explanation of the code just LMK.