I have a file named annoucements.php which i am trying to get the contents of announcements.php to appear in my index.php below is the code i have to pull the data from announcements.
<script type="text/javascript">
$(document).ready (function(){
$.ajax({
type:"GET",
url: "announcements.php",
dataType: "xml",
success: parseXml
});
});
function parseXml(xml){
$(xml).find("announcement[current='yes']").each(function()
{
$("#ann").append("<p class='ann_title'>" + $(this).attr('date') + ' ' + $(this).attr('time'));
$("#ann").append("<p class='ann_body'>" + $(this).text());
});
}
</script>
at the end of the file I have another piece of code which i hoped would display the contents. for the purpose of the help i have hard coded some data in
<div id="ann">
<p class="ann_title">21/03/2011 11.35am</p>
<p class="ann_body">Materials for week 9 are now online. Note: A 50 minute video on usability testing will be shown in class on Wednesday which may run past the usual end time of 11.05 pm.</p>
</div><!-- ann -->
How can i get the information to automatically appear in <p class="ann_title"> instead of hard coding it?
Thanks in advance for your help
<script type="text/javascript">
$(document).ready (function(){
$.ajax({
type:"GET",
url: "announcements.php",
dataType: "xml",
success: parseXml
});
});
function parseXml(xml){
$(xml).find("announcement[current='yes']").each(function()
{
$("#ann").append("<p class='ann_title'>" + $(this).attr('date') + ' ' + $(this).attr('time'));
$("#ann").append("<p class='ann_body'>" + $(this).text());
});
}
</script>
at the end of the file I have another piece of code which i hoped would display the contents. for the purpose of the help i have hard coded some data in
<div id="ann">
<p class="ann_title">21/03/2011 11.35am</p>
<p class="ann_body">Materials for week 9 are now online. Note: A 50 minute video on usability testing will be shown in class on Wednesday which may run past the usual end time of 11.05 pm.</p>
</div><!-- ann -->
How can i get the information to automatically appear in <p class="ann_title"> instead of hard coding it?
Thanks in advance for your help