js get file name from path

JavaScript
var filename = location.pathname.substr(location.pathname.lastIndexOf("/")+1);
var filename = fullPath.replace(/^.*[\\\/]/, ''); // works for both / and \ document.getElementById("retreiveData").innerHTML = "<p>Message</p> <a href=message>" + key + "</a> <p>ok?</p>"
Source

Also in JavaScript: