In javaScript, currently reading xml files stored in %appdata% using jQuerys $.ajax function. As the file is in %appdata% my javaScript has access to read and write the file.
Example:
/**
* Read a foo.
*/
function readFoo() {
var xmlFile = "../foo/bar.xml";
$.ajaxSetup({cache: false});
$.ajax({
type: "GET",
async: true,
timeout: 5000,
url : xmlFile,
dataType : "xml",
success: parseFoo,
error: reportFooFail
});
}
Is it possible using jQuery or plain javaScript to get the files 'last modified' date?
request.getResponseHeader("Last-Modified"); will return you the last-modified date
Use it in the success callback:
success: function(data, textStatus, request){
var lastModified = request.getResponseHeader("Last-Modified");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With