1

I'm creating a function that displays when the last file was modified. I was trying to make this code works, but it doesn't display anything.

function send() {
    var xhttp = new XMLHttpRequest();
    xmlhttp.open("GET", "file.xml", false);
    xmlhttp.send();
    myfunction(xhttp);
 }
 
function myfunction(xml) {
    var xmlDoc = xml.responseXML;
    var date = xmlDoc.lastModified;
    alert(date);
}

sonia
  • 93
  • 5

1 Answers1

0

the lastModified method operates on a DOM element. In your example, the file is a String.

jzProg
  • 279
  • 1
  • 2
  • 8