I have this xml file which has text init.
i.e
Hi my name is steven
When i add a Setinterval to load the xml file every 10 seconds i get
Hi my name is stevenHi my name is stevenHi my name is stevenHi my name is steven
This continues duplicating every 10 seconds
Here is my javascript xml function
myLoadInteval = setInterval(Xml, 10000);
function Xml(){
$(document).ready(function() {
$.ajax({
type: "GET",
url: "http://www.mobilefriendlywebapps.co.uk/tayloredtest1/note.xml",
dataType: "xml",
success: parseXml
});
function parseXml(xml) {
$(xml).find("menu").each(function() {
//find each instance of loc in xml file and wrap it in a link
$("div#site_list").append( $(this).find("cd").text() );
$("div#treatments").append( $(this).find("cd1").text() );
$("div#preparation").append( $(this).find("cd2").text() );
$("div#products").append( $(this).find("cd3").text() );
$("div#info").append( $(this).find("cd4").text() );
$("div#price").append( $(this).find("cd5").text() );
$("div#promo").append( $(this).find("cd6").text() );
});
}
});
}
How do i remove the old xml before the new on loads?
Rather than using append() use html()
i.e